I am writing a very very little extension to append an argument to a specific URL
Here is what I have now in a background script:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (tab.url.indexOf("developer.apple.com/reference") != -1 && tab.url.indexOf("?language=objc") == -1) {
var objcURL = tab.url + "?language=objc";
chrome.tabs.update(tab.id, {url: objcURL});
}
});
The issue with this is that it ruins my navigation stack. For example, if a user goes to
it will then navigate the user to
https://developer.apple.com/reference/appkit/nsapplication?language=objc
And if they hit back, it will go back to the first link, which then just redirects the user to the second link again. So you can never back out
My question is, is there any way to redirect the user directly to the second link when they make a request for the first link?