我使用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