First off, please learn how to help yourself by learning how to debug extension popups. It involves right-clicking the button and selecting Inspect popup.
If you do that, the first thing you'll see is something along those lines:
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
That's because Chrome's restrictive Content Security Policy for extensions doesn't allow setting click handlers with a string of text in the HTML itself. See onClick within Chrome Extension not working for more information.
Furtherfore, what do your handlers try to achieve? If you click on this in a popup window, window
refers to the popup itself. I doubt you want to load said sites in the popup itself, you probably want to open a new tab instead. I don't think you can navigate the popup window itself to an external website.
You are presented with a choice in fixing this:
The path of least resistance is to use pure HTML links instead of JS:
<a href="https://www.gmail.com" target="_blank">Gmail</a>
You could then style this <a>
element as you wish - it can look like a button.
If you specifically want <input type="button">
elements, you need to follow the standard procedure using addEventListener
for "click"
events in your popup.js
. See CSP documentation and the onClick
question linked above - as well as code in the other answer.
You'll want to use chrome.tabs.create
instead to open links in new tabs, for example:
chrome.tabs.create({url: "https://gmail.com"});
See also this question: Open new tab without losing popup focus.