我使用xapiwrapper.min.js和文件喜欢它来发送报表给LRS。我自己的包含javascript的文件被称为init.js,如下所示。 Init.js是从我的其他主html5文件中引用的。随着您在init.js文件中进一步查看,您将看到ADL LRS的一些凭证信息。有没有什么办法可以让用户不能看到它?如何隐藏或保护在交互身份验证凭据与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:[email protected]?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"));
});
应该是, 1)使用OAuth使上述建议“更容易”,因为OAuth更容易__never__。 不让我编辑一个字符:( – garajo