2

根据MDN,我们可以使用该simple-storage模块使用浏览器的本地存储。但是当我试图在 .js 文件中包含任何包时,我收到错误消息

JPM undefined   Message: ReferenceError: require is not defined

我的一个js文件的示例代码如下

// Creating the Object for Accessing the local browser storage
var ss = require("sdk/simple-storage");
//Fetching the values in the various fields
var id = document.getElementById("usermail");
var pass = document.getElementById("password");
var login = document.getElementById("login");

//Saving the values for the id and password fields

login.addEventListener("click", function() {
    storage_object.storage.Email = id.value ;
    storage_object.storage.Password = pass.value;
    login_Email = storage_object.storage.Email; 
    login_pass = storage_object.storage.Password;
    alert(login_pass);
});

如何在插件中使用浏览器本地存储?

4

0 回答 0