I need a way in my Chrome extension to know when the browser is starting up, so that it can automatically open an html page. Is there a mechanism in Chrome extension API that can get me this facility?
I need this functionality for a personal extension of mine, that I use only on my computer. So it's ok if this can be accomplished through a hack. My extension would like to know when the browser has started.
Any ideas?
When you turn on Google Chrome browser sync, then all your chrome extensions will be automatically installed on all your devices. Also, the settings and state for all these extensions will be the same on all your devices.
Chrome extensions are built with HTML, JavaScript, and CSS scripts and are essentially small websites uploaded to the Chrome store. The only difference between a Chrome extension and a regular website is that extensions contain a manifest file, which gives them a specific function to execute.
if you want the tab to open when Chrome is started up, you can just include the code: chrome.tabs.create({url:"someUrl"});
in your background.js file or if you want it to open everytime a new window opens, you can include the previous code plus an extra event listener to the new window event like this:
chrome.windows.onCreated.addListener(function() {
chrome.tabs.create({url:"someUrl"});
})
Scripts in background page start only one time on each browser start, so you just need to add background page to your extension to handle browser start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With