0
我目前正在編寫一個Chrome擴展。這是明顯的:在Chrome選項頁面上出現安全錯誤
{
"manifest_version": 2,
"name": "whatever",
"short_name": "whocares",
"description": "blabla",
"version": "1.0.2",
"author": "me",
"permissions": [
"http://ajax.googleapis.com/"
],
"content_scripts": [
{
"matches": ["https://plus.google.com/*"],
"js": ["jquery-1.10.2.min.js","filter.js","settings.js","settings.html"]
}
],
"options_page": "settings.html",
"browser_action": {
"default_icon": "nicepic.png"
}
}
這是options.html頁:
<html>
<head>
<script type="text/javascript" src="settings.js"></script>
</head>
<body onload="CollectSettings()">
<h2>Options:</h2>
<form>
(some stuff)
</form>
</body>
</html>
以下錯誤被拋出:
拒絕,因爲它違反了 執行內聯事件處理程序遵循內容安全策略指令:「script-src'self' chrome-extension-resource:」。
CollectSettings()是settings.js
我想有那種背景的只有JS-限制內的功能 - 腳本,而不是在選項頁?
[Content-Security-Policy error in google chrome extension making]可能出現重複(http://stackoverflow.com/questions/11045653/content-security-policy-error-in-google-chrome-extension-making) – Teepeemm
這是2歲,有一個獨特的答案。 Shiuld不會被標記爲重複imho。 –