Could someone assist me in changing the current tab URL to a different website, such as , using a chrome extension?
Here is my JavaScript code:
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
var tab = tabs[0];
console.log(tab.url);
});
In this code, tab.url fetches the URL of the current page. I am looking to accomplish something like the following:
if(tab.url=="https://www.google.com/")
{
//redirect this page to https://stackoverflow.com/
}
else
{
//stay on the same page
}
Essentially, I want the extension to automatically redirect to stackoverflow when the current tab is google.com.