我是google chrome extention开发中的新手。 我正在尝试开发一个简单的扩展,并且我不断收到上述错误。
我的清单:
{
"name": "set my favourties",
"description" : "just another super awesome plugin",
"version" : "0.1",
"background": {
"page": "backround.html"
},
"manifest_version": 2,
"content_security_policy": "script-src 'self' https://www.google.com; object-src 'self'",
"browser_action" :{
"popup" : "popup.html",
"default_icon" : "icon.gif"
},
"permissions" : ["notifications"]
}
html代码:
<html>
<head>
<script src = "backround.js">
</script>
</head>
<body onload = "loadHandler()">
</body>
</html>
和js:
function loadHandler(){
window.webkitNotifications.createNotification("icon.gif","Plugin Loaded","it was loaded").show();
}
提前致谢
尼尔
答案 0 :(得分:17)
如果这不是Chrome扩展程序,您可以将加载脚本,但您应该避免使用内联事件处理程序。< / p>
'unsafe-inline'
添加到可接受的地方列表中以从
替换(在HTML中):
onload = "loadHandler()"
with(在脚本中):
window.addEventListener('load', loadHandler);
答案 1 :(得分:6)