Skip to content Skip to sidebar Skip to footer

Chrome Extensions: Open Link In New Tab Upon Loading Of A Particular Page?

I'd like to create a Chrome extension where, when a particular URL opens, another URL opens automatically in a new tab. Note that I'd like the new tab to open as soon as the first

Solution 1:

In a background page:

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
    if(changeInfo.status == "loading" && tab.url == "http://old/url") {
        chrome.tabs.create({url: "http://new/url"});
    }
});

Post a Comment for "Chrome Extensions: Open Link In New Tab Upon Loading Of A Particular Page?"