我正在使用 xapiwrapper.min.js 和类似的文件将语句发送到 LRS。我自己的包含 javascript 的文件称为 init.js,如下所示。Init.js 是从我的其他主要 html5 文件中引用的。当您进一步查看我的 init.js 文件时,您会看到一些 ADL LRS 的认证信息。有什么办法可以防止用户看到这个?
init.js 文件
<!--This happens when the user clicks the Submit button.-->
$("#myButton").click(function(){
//creating a couple of local variables
var name = $("#nameID").val();
var email = $("#emailID").val();
if(name=='') {
alert("Please enter a name");
myForm.name.focus();
return (false);
}
if(email=='') {
alert("Please enter an email");
myForm.name.focus();
return (false);
}
//creating global variables
setGlobal(email, name);
//move to page 2
document.location.replace("tableOfContents.html");
});
//Setting some global variables in case we need them later.
function setGlobal(actEmail, actName) {
// Save the name in localStorage.
localStorage.setItem('name', actName);
// Save the email in localStorage.
localStorage.setItem('email', actEmail);
}
<!--When the user clicks the feedback link-->
$("#feedback").click(function(){
window.open('mailto:internaltraining@syniverse.com?subject=Feedback on MS Office 365 tutorials');
});
<!--When the user clicks the logout link-->
$("#logout").click(function(){
localStorage.removeItem("name");
localStorage.removeItem("email");
document.location.replace("index.html");
});
// Auth for the ADL LRS
var conf = {
"endpoint" : "https://lrs.adlnet.gov/xapi/",
"user": "xapi-tools",
"password": "xapi-tools",
"auth": "xapi-tools"
};
$("#myModal").on('hidden.bs.modal', function (e) {
$("#myModal iframe").attr("src", $("#myModal iframe").attr("src"));
});