1

我正在制作一个 chrome 包应用程序。这是我的 manifest.json

  "app": {
"launch": {
  "local_path": "main.html"
}

"content_scripts": [
{
  "matches": ["http://*/*", "https://*/*", "file://*/*"],
  "js": ["jquery-1.7.min.js", "content_script.js"],
  "all_frame": "true"
}

为什么我的内容脚本无法在 main.html 上运行?内容脚本可以在包应用程序上运行吗?

4

1 回答 1

1

内容脚本不能在chrome-extension:协议[ 1 ]上运行。因此,内容脚本不会在您的应用程序中运行。

将脚本包含在main.html

<script src="jquery-1.7.min.js"></script>
<script src="content_script.js"></script>

[ 1 ]:唯一允许的协议是http:和。对于所有其他协议,即使指定了内容脚本,也不会注入。https:file:<all_urls>

于 2012-03-12T15:40:28.100 回答