1

I have a Chrome extension with browser_action popup:

  "browser_action": {
    "default_icon": {                   
      "16": "images/icon16.png",        
      "24": "images/icon24.png",        
      "32": "images/icon32.png"         
    },
    "default_popup": "popup.html"
  },

The popup.html has these items:

<body>
<ul>
    <li>Item 1</li>
    <li>Item 2</li>
</ul>
</body>

I want to implement the following: when a user clicks on Item 2 I would like to open my extension's item2.html page in new browser tab.

I do not really know where to dig, so any help will be appreciated. Thanks!

Sergei Ledvanov
  • 1,841
  • 4
  • 25
  • 47
  • 2
    Either add `Item 2` or use chrome.tabs.create in your popup script. – wOxxOm Nov 30 '18 at 12:48
  • If I go the second route, how do I handle on click event in popup.js script? I get all kind of "Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem: chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. " exceptions, so maybe I am doing it wrong? – Sergei Ledvanov Nov 30 '18 at 12:58
  • Use a [separate script file](https://stackoverflow.com/a/25721457). Also, I think it's best to start off an existing extension e.g. one of the [official samples](https://developer.chrome.com/extensions/samples). – wOxxOm Nov 30 '18 at 13:12

0 Answers0