【发布时间】:2016-10-21 20:41:40
【问题描述】:
我一直在尝试将我用 jQuery/HTML 制作的简单程序移动到 Firefox WebExtension 以便于部署。我得到的错误是:
Content Security Policy: The page’s settings blocked the loading of a resource at https://code.jquery.com/jquery-1.12.4.js (“script-src moz-extension://ef8f1295-1912-4912-ab2e-121053b6781a”).
我确定我只是没有正确地处理 manifest.json 文件,但对于我的一生,我不知道在哪里:
{
"description": "Makes tasks from different underwriters uniform",
"manifest_version": 2,
"name": "Task Creator",
"version": ".5",
"permissions": [
"http://*/*", "tabs", "https://*/*"
],
"icons": {
"48": "icons/page-48.png"
},
"web_accessible_resources": [
"style/popUpStyle.css",
"script/popUpTask.js",
"script/logicTaskFiller.js",
"js/autosize.js",
"style/https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css",
"js/https://code.jquery.com/jquery-1.12.4.js",
"js/https://code.jquery.com/ui/1.12.1/jquery-ui.js"
],
"background": {
"scripts": ["background.js"]
},
"browser_action": {
"default_icon": "icons/page-32.png"
}
}
【问题讨论】:
-
js/https://code.jquery.com/jquery-1.12.4.js是无效的文件路径。使用js/jquery-1.12.4.js并确保文件在那里。 -
我不能从外部网站加载 jquery 吗?
-
你可以手动完成,但不能通过 manifest.json
-
很高兴知道,谢谢....由于您在 cmets 中,我无法真正将您标记为答案,呵呵
-
"我不能从外部网站加载 jquery 吗?"你可以。你应该?有什么改进?
标签: javascript html firefox-addon-webextensions