我已经包括了一些JS到我的CE(Chrome扩展)
"content_scripts": [ {
"js": ["jquery-latest.min.js", "sample.js"....
//....
如何通过单击sample.js
中的复选框禁用popup.html
我应该使用什么Chrome方法来停止执行sample.js
。在再次单击复选框之前,我不想使用它。
发布于 2013-12-08 17:57:16
如果您希望有条件地包含它,那么就不要在manifest.json
中包含它。
使用executeScript代替。
if(document.getElementById("checkbox-id").checked == true)
chrome.tabs.executeScript(null, {file: "sample.js"});
这就是所谓的程序化注入
https://stackoverflow.com/questions/20456421
复制相似问题