我試圖從chrome.storage.local加載內容,但它不起作用(它總是返回相同的結果,[object OBJECT])。 這是我的代碼:Chrome.storage.local得到錯誤的值
function load()
{
var loginC = "";
chrome.storage.local.get('loginC', function(result){
loginC = result;
if (loginC != "") {
document.getElementById("login").value = loginC;
}
});
var passC = "";
chrome.storage.local.get('passC', function(result){
passC = result;
if (passC != "") {
document.getElementById("pass").value = passC;
}
});
}
load();
仔細查看['chrome.storage.local.get']的文檔(https://developer.chrome.com/extensions/storage#method-StorageArea-get) – 2014-10-06 10:12:31