Reputation: 39859
I searched on Google and Stack Overflow, and I was not able to find a solution to my problem.
I'm looking to display the popup, exactly like when the user click on the icon of my extension, but via JavaScript.
The idea behind it is simple : On a specific page, I inject a button and add an event listener on it ("click"). When the user click on that button, I'd like to display the tooltip.
Any ideas?
Upvotes: 0
Views: 2283
Reputation: 191
Unfortunately, according to Chrome Extension FAQ:
...popups can only be opened if the user clicks on the corresponding page or browser action. An extension cannot open its popup programmatically.
Upvotes: 0
Reputation: 10897
As per your description,
On a specific page, I inject a button and add an event listener on it ("click"). When the user click on that button, I'd like to display the tooltip, simple as that :)
I think what you need is just chrome.pageAction, it's similar to browserAction, while represents actions that can be taken on the current page, but aren't applicable to all pages.
Upvotes: 0
Reputation: 5106
Opening the popup is impossible without user interaction. For good reason too, remember that no one likes popups that open themselves. What you can do is inject your popup onto the site the user is at, through a content script. https://developer.chrome.com/extensions/content_scripts
Upvotes: 2