我有一个Google Chrome扩展。
我想在我的内容脚本中加载jQuery。如果我发送jquery.js并更改清单,这就很简单了
{
"name": "My extension",
...
"content_scripts": [
{ "js": ["jquery.js", "myscript.js"], ... }
],
...
}现在,只有当用户在选项页面中选中了相应的选项时,我才需要jQuery。
为了优化我的代码,我如何才能仅在需要时才在内容脚本中加载jQuery?
发布于 2011-12-04 00:45:04
使用chrome.tabs.executeScript。在content_script documentation page上有一个例子。
https://stackoverflow.com/questions/8368827
复制相似问题