Hi I want to create a chrome extension so that when the user is on the page example1.com he would automatically be redirected to example2.com even before the page loads. this should work whether or not the user types in the url or goes there through a link.
Please help me in this!
Thanks.
In background page:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if(tab.url.indexOf("http://example1.com") == 0 && changeInfo.status == "loading") {
chrome.tabs.update(tabId, {url: "http://example2.com"});
}
});
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