Send redirect url from a content script to a background page:
chrome.runtime.sendMessage({redirect: "http://redirect"});
In a background page update tab's url which would cause redirect:
chrome.runtime.onMessage.addListener(function(request, sender) {
chrome.tabs.update(sender.tab.id, {url: request.redirect});
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…