我尝试构建一个 Safari 应用程序扩展。javaScript popup.js 不会针对工具栏图标运行。popup.html 显示正确。
popup.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="popup.js"></script>
<link rel="stylesheet" href="popup.css">
</head>
<body>
<strong>Hello World!</strong>
</body>
</html>
popup.js
alert("Test");
清单.json
{
"manifest_version": 2,
"default_locale": "en",
...
"background": {
"scripts": [ "background.js" ],
"persistent": true
},
...
"browser_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/toolbar-icon-16.png",
"19": "images/toolbar-icon-19.png",
"32": "images/toolbar-icon-32.png",
"38": "images/toolbar-icon-38.png"
}
},
"permissions": ["notifications",
"create",
"tabs"]
}