MV3: chrome.action.onClicked.addListener not working?

9,174 views
Skip to first unread message

Sonny Chee

unread,
Mar 23, 2022, 2:14:00 PM3/23/22
to Chromium Extensions
Hey Guys,

So in MV2, this used to work:

chrome.browserAction.onClicked.addListener(function(tab) {
  window.open( "https://www.no-password.com", "_blank" );
})

I've revised to:

chrome.action.OnClicked.addListener( .... 

No error message or warnings in the console when I click the extension icon. I found a 2019 conversation (https://groups.google.com/a/chromium.org/g/chromium-extensions/c/9WqUFsURnsc) that this was not working but nothing since....

Any suggested workaround would be greatly appreciated.

Stefan vd

unread,
Mar 23, 2022, 2:45:33 PM3/23/22
to Chromium Extensions, sonny...@gmail.com
Hi Sonny,

That works just fine here in my Chrome version 99.0.4844.83.

Chrome extension manifest v3 with this as background.js code:
chrome.action.onClicked.addListener((tab) => {
chrome.tabs.create({url: "https://www.youtube.com"});
});

Thanks,
Stefan vd

Sonny Chee

unread,
Mar 23, 2022, 4:26:32 PM3/23/22
to Chromium Extensions, Stefan vd, Sonny Chee
Thanks Stefan, that worked like a charm.

Stefan vd

unread,
Mar 23, 2022, 4:31:56 PM3/23/22
to Chromium Extensions, sonny...@gmail.com, Stefan vd
Hi Sonny,

You are welcome!

Thanks,
Stefan vd

Reply all
Reply to author
Forward
0 new messages