developer.chrome.com
developer.chrome.com copied to clipboard
The `openPopup` method is `undefined` in Chrome `100.0.4896.75` yet the doc says otherwise.
Describe the bug
According to the documentation, the openPopup method should be available in Chrome 99+ but I get the Uncaught TypeError: chrome.action.openPopup is not a function error when I run the code below.
chrome.runtime.onInstalled.addListener(() => {
console.log("Immediately");
setTimeout(() => {
console.log("After 10s");
console.log(chrome.action.openPopup); // undefined
chrome.action.openPopup();
}, 10000);
});
Below is my manifest.json file.
{
"name": "dewall",
"description": "Removes paywall on select websites",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"permissions": [
"storage",
"notifications"
],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
}
}
I am using 100.0.4896.75 (Official Build) (64-bit) . Either the way I am using the openPopup method is incorrect or the documentation is incorrect.
To Reproduce Steps to reproduce the behavior:
- Create a basic extension using
MV3 - Add the code above in
background.js
Expected behavior
The extension will throw the Uncaught TypeError: chrome.action.openPopup is not a function error after 10s. I would have expected openPopup to not be undefined.
Screenshots N/A
Desktop (please complete the following information):
- OS: Pop!_os
- Browser: Chrome
- Version: 100.0.4896.75 (Official Build) (64-bit)
Smartphone (please complete the following information): N/A
Additional context N/A
CC: @dotproto to confirm whether this is a documentation issue or something else.
Experiencing the same issue in both chrome and edge. I have verified that my browsers are up to date.
Please update with a timeline for when chrome.action.openPopup will be available and update the docs to reflect the current status.
To avoid any bad surprises, I believe the openPopp() is only available inside of a user triggered event handler as explained here. Also MDN documentation seems to have very good explanation about Chrome API usage.
To avoid any bad surprises, I believe the
openPopp()is only available inside of a user triggered event handler as explained here. Also MDN documentation seems to have very good explanation about Chrome API usage.
Have you tried this in chrome? Because I still get undefined even in chrome.action.onClicked.
chrome.action.onClicked.addListener((tab) => {
console.log(chrome.action.openPopup); // undefined
});
@nibble0101 I was wrong on my last statement. After doing some research it appears that Chrome's action.openPopup() is supposed to be more relaxed about user actions than Mozilla's browserAction.open(). Currently action.openPopup() seems to be missing from stable channel. See comment
@nibble0101 I was wrong on my last statement. After doing some research it appears that Chrome's action.openPopup() is supposed to be more relaxed about user actions than Mozilla's browserAction.open(). Currently action.openPopup() seems to be missing from stable channel. See comment
Okay thanks.
this is really weird, the function is listed in the docs but it's not available yet. how is that possible?
I made some tries with canary and it seems that second parameter (windowId) is useless. it'd seem that only focused tab can open the popup
Just tried this again in both stable versions of Edge and Chrome. The openPopup function is still undefined.
Is there any official update on this? Is this even the proper place to report such a bug? If not, please advise on where to report this so that it can be addressed.
Same issue, anything new now?
also having this issue... is there any other way to programmatically trigger a popup opening?
This doesn't work in other contexts either, even if they are user-triggered, such as a listener of chrome.commands.onCommand
Chrome version: Version 104.0.5112.101 (Official Build) (arm64)
Just checked again a couple months later and this is still happening.
Some transparency on the status of this bug would be much appreciated.
Still present. Is there no other way?
For now I open new tab with popup URL to do some actions I need. But that is not very pleasant UX
Are there any updates here? Because this prevents me from publishing my Chrome extensions, chrome.action.openPopup() is not available in the Chrome stable (version 106.0.5249.119):
- Turn Off the Lights https://chrome.google.com/webstore/detail/turn-off-the-lights/bfbmjmiodbnnpllbbbfblcplfjjepjdn
- Zoom https://chrome.google.com/webstore/detail/zoom-for-google-chrome/lajondecmobodlejlcjllhojikagldgd
- Full Screen https://chrome.google.com/webstore/detail/full-screen-for-google-ch/gmimocjjppdelmhpcmpkhekmpoddgima
I did the test on my Manifest V3 Print Chrome extension that is already on the Chrome Web Store: https://chrome.google.com/webstore/detail/print-for-google-chrome/idfnpgjblkahngbondojabhffkkdekbd But my "double click" menu does not work on the Chrome stable channel, but it does work on the Chrome Dev channel.
I want to publish my Chrome extensions before the end of this year.
on 7 Jun I wrote: "... it'd seem that only focused tab can open the popup ..." You have to put first the focus on the right window (no devtools windows). A good workaround could be this: chrome.tabs.getCurrent(tab => { chrome.windows.update(tab.windowId, {focused:true}, _ => chrome.action.openPopup()) })
chrome.action.openPopup() work in chromium browser Version 106.0.5249.91 and chrome dev Version 108.0.5343.2.
but don't work on brave browser( chromium version Version 106.0.5249.103).
chrome.action.openPopup()work in chromium browser Version 106.0.5249.91 and chrome dev Version 108.0.5343.2. but don't work on brave browser( chromium version Version 106.0.5249.103).
Still not working on stable version (107.0.5304.88)
This is also broken for Edge 107.0.1418.42
chrome.action.openPopup()work in chromium browser Version 106.0.5249.91 and chrome dev Version 108.0.5343.2. but don't work on brave browser( chromium version Version 106.0.5249.103).Still not working on stable version (107.0.5304.88)
Seconded. Works in Chromium Version 108.0.5359.71 but not Chrome Version 107.0.5304.110.
Calling from an onMessage listener within the Service Worker:
chrome.runtime.onMessage.addListener(
// Open extension popup
if (typeof chrome.action.openPopup === 'function') {
console.log("Open the popup");
chrome.action.openPopup({}, function() {
console.log("Popup opened");
});
}
else {
console.log("chrome.action.openPopup() not supported");
}
);
Seeing the same issue on Chrome Version 108.0.5359.94 (Official Build) (arm64)
Same here with chrome version 107.0.5304.121. Hope google people fix this issue soon.
I'm having the same issue in Chrome Version 108.0.5359.124 (Official Build) (arm64) this doesn't make sense. How could you publish documentation about something that doesn't exist?
Is there another way to open the chrome extension other than use the extension icon? I have a project of an extension where the webpages get buttons injected that send messages that reaches background script, and then I need to open the chrome extension programmatically. This is the final piece that is missing to build this user experience flow.
I tested all my browsers and these are my results:
Chromium: 108.0.1462.54 (Build ufficiale) (64 bit) DOESN'T WORK Chromium: 108.0.1462.76 (Build ufficiale) (64 bit) DOESN'T WORK Chromium: 108.0.5359.94 (Build ufficiale) (a 64 bit) DOESN'T WORK Chromium: 108.0.5359.95 (Build ufficiale) (a 64 bit) WORKS!!! Chromium: 108.0.5359.128 (Build ufficiale) (a 64 bit) DOESN'T WORK Chromium: 108.0.5500.0 (Build ufficiale) (a 64 bit) WORKS!!!
It'd seem the classic "too short blanket" riddle
@dotproto It seems it was discussed on April's public meeting. Was there an outcome for this, like updating the documentation or adding the actual functionality in a stable release?
Seeing the same issue on Chrome Version 109.0.5414.87 (Official Build) (arm64)
on. mac m1
Is there another way to open the chrome extension other than use the extension icon? I have a project of an extension where the webpages get buttons injected that send messages that reaches background script, and then I need to open the chrome extension programmatically. This is the final piece that is missing to build this user experience flow.
Did you find any way to open up the popup?
Same issue with Chrome Version 110.0.5481.77 (Official Build)
@vu0tran nah, we had to descope the feature that would make use of this function. I know we can do a workaround like "painting" stuff by injecting HTML code in the webpage to show some small window but that sucks.
I mean if the documentation says something it has several consequences. We got involved in this project of building a chrome extension promising something that could be done based on what we researched and found in the documentation, to later back off with that feature.
If there's no intention of enabling such functionality then just update the documentation by removing the reference to it. Is that so difficult?