Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have an issue with my chrome extension. I want to open it automatically when the page is loaded.

For example, if a user opens stackoverflow.com, my chrome extension popup opens automatically.

I am using chrome.runtime.onMessage.addListener on contentScript js file but it's running after click on extension icon.

So I want to make it open without clicking the extension icon.

Any help here will be greatly appreciated.

What I have tried:

I am using chrome.runtime.onMessage.addListener on contentScript js file but it's running after click on extension icon.
Posted
Updated 30-Jun-21 22:43pm

1 solution

Try reading the documentation for writing a Chrome extension. The event you're looking for is chrome.webNavigation.onCompleted:
chrome.webNavigation - Chrome Developers[^]

You will need to add the relevant permissions to your extension's manifest.

This SO thread has more details: On page load event in Chrome extensions - Stack Overflow[^]

NB: An extension that pops up a new window when a page is loaded is likely to annoy your users. Depending on what the popup does, it could even be seen as malware.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900