Forum Discussion
How to access xAPI/Tin Can LMS variables in JavaScript
Hi, can anyone help me? Nandhakumar S code doesn't work quite right.
The Tin Can code works on Scorm Cloud but not on our custom system. We get mailto
Is there any workaround?
This might be occuring because of mbox.
function getParameterByName(name, url)
{
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
var a =[];var a1 = [];
var foo = getParameterByName('actor');
a = foo.split(",");
var x=a[0];
a1 = x.split(":");
var str = a1[1];
var UName = str.replace(/[^a-zA-Z ]/g, "");
var player = GetPlayer();
player.SetVar("Username",UName);
Appreciated!
Steven did you end up get a working result? I'm having a similar issue.