I'm working with Microsoft Edge extension.
I would to redirect users if they navigate in a specific url. In my background.js script I have this:
browser.webNavigation.onBeforeNavigate.addListener(
function(details) {
if(details.url.indexOf("url_path") > -1){
alert("caught");
window.location = "http://new_url.com";
}
}
);
The alert work, but not the redirect. What I'm doing wrong? Also is a good idea pass user e pass for http auth in the redirect? For example: windows.location = "http://user:pass@new_url.com" ?
thanks :)