所以我有这个代码,我尝试设置分数。
var score = 0;
chrome.storage.sync.set({"playerScore": score});
我的manifest.json文件中启用了存储,所以不是这样。对不起,如果解决方案很明显,我还是比较新用的。
清单文件
{
"manifest_version": 2,
"name": "Red Dot",
"description": "This extension is a quick little game I made. It is worthless,
but it should provide you with at least 5 seconds of entertainment.",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"activeTab",
"storage"
]
}
该脚本名为“script.js”,用于“popup.html”文件。