Get country from IP address with JavaScript

This uses the telize site to get a geolocation of an IP address. It's not 100% accurate but fine for country-level location, which is all I wanted. <script type="application/javascript"> function getgeoip(json){ //document.write("Geolocation information for IP address : ", json.ip); //document.write("Country : ", json.country); //document.write("Latitude : ", json.latitude); //document.write("Longitude : ", json.longitude); //document.write("Country: " + json.country);... Continue Reading →

Set a SCORM completion in Storyline using javascript

Run this as a 'run JavaScript' in Storyline and you're done-burgers. Storyline 360 (20.03.2018) function findLMSAPI(win) { if (win.hasOwnProperty("GetStudentID")) return win; else if (win.parent == win) return null; else return findLMSAPI(win.parent); } var lmsAPI = findLMSAPI(this); //set score; the first number is the score lmsAPI.SetScore(100, 100, 0); //set status; possible values: "completed","incomplete", "failed", "passed" lmsAPI.SetReachedEnd();... Continue Reading →

Call AS3 functions from javascript and vice versa

To communicate between JavaScript and Actionscript it isn't so hard. FLASH: import flash.external.ExternalInterface; ExternalInterface.addCallback("sendTextToFlash", getTextFromJavaScript); function getTextFromJavaScript(str):void { trace(str); } JAVASCRIPT: var currentPage="Home"; function setCurrentPage(newPage) { currentPage = newPage; SendDataToFlashMovie(newPage); } So then on the page, this code is run when an item is clicked (javascript function sending to flash) <a href="javascript:void(0);" onClick="setCurrentPage('Home')">Home</a> This javascript... Continue Reading →

Write to local drive with javascript – hta

This will create a text file 'text.txt' in the folder where test.hta is residing. Could use to create xml and config files with javascript for courses to manipulate later. <html> <head> <script language="javascript"> function WriteToFile() { try { var fso, s; fso = new ActiveXObject("Scripting.FileSystemObject"); /* s = fso.OpenTextFile("C:\\test.txt" , 8, 1, -2); */ s... Continue Reading →

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑