DEV Community

Basha
Basha

Posted on

How to add a popup for chrome extension?

Hello:)
To add a popup html to a chrome extension you will need to add the following code to the manifest.json file

"action": {
    "default_popup": "popup.html"
  },
"content_scripts": [
      {
          "matches": [
            "<all_urls>"
          ],
          "js": ["popup.js"],
          "css": ["popup.css"]
      }
  ]
Enter fullscreen mode Exit fullscreen mode

and make the _popup.html file_, _popup.css_, and the _popup.js _files.

Top comments (2)

Collapse
 
ndewald profile image
Nicholas DeWald

Thanks for the code snippet.

Collapse
 
bashamega profile image
Basha

your welcome