0

I try to build a Safari App extension. The javaScript popup.js does not run for the toolbar icon. The popup.html is displayed correctly.

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");

manifest.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"]
}

Saiboter
  • 21
  • 2

1 Answers1

0

I solved the problem by moving <script src="popup.js"></script> in the body part:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="popup.css">
</head>
<body>
    <strong>Hello World!</strong>
    <script src="popup.js"></script>
</body>
</html>
Saiboter
  • 21
  • 2