Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open my extension's pop-up with JavaScript?

I am trying to write a JavaScript function that will open my extension like when the extension icon is clicked. I know how to open my extension in a new tab:

var url = "chrome-extension://kelodmiboakdjlbcdfoceeiafckgojel/login.html"; window.open(url); 

But I want to open a pop-up in the upper right corner of the browser, like when the extension icon is clicked.

like image 299
Yuqing Huang Avatar asked May 07 '12 09:05

Yuqing Huang


People also ask

How do I open Chrome extension popup content script?

They've set the default shortcut to Ctrl+D . Activating this command will perform a click on the page (or browser) action, opening the popup or whatever the action is configured to do.


1 Answers

The Chromium dev team has explicitly said they will not enable this functionality. See Feature request: open extension popup bubble programmatically :

The philosophy for browser and page action popups is that they must be triggered by user action. Our suggestion is to use the new html notifications feature...

Desktop notifications can be used progammatically to present the user with a small HTML page much like your popup. It's not a perfect substitution, but it might provide the type of functionality you need.

like image 169
apsillers Avatar answered Sep 21 '22 21:09

apsillers