We have mountains of Javascript. Somewhere in there, a redirect is happening that we don't want. How can you generically debug which code caused a redirect? A stack trace would be perfect.
In that case, the new page can use JavaScript to redirect our article to a phishing page asking for BleepingComputer credentials. To prevent this from happening, a rel="noopener" HTML link attribute was created that prevents a new tab from using JavaScript to redirect the page.
“If you need to change the URL of a page as it is shown in search engine results, we recommend that you use a server-side 301 redirect. This is the best way to ensure that users and search engines are directed to the correct page. The 301 status code means that a page has permanently moved to a new location.”
JavaScript has the APIs that allow you to redirect to a new URL or page. However, JavaScript redirection runs entirely on the client side. Therefore it doesn't return the status code 301 (move permanently) like a server redirection.
There's no easy way. You could do a mass search in your files for some words like "redirect", "window.location", "location" and the like.
Another person asked a similar question. Someone gave a helpful option in chrome debugging tools that you could try out. See link below.
Break javascript before an inline javascript redirect in Chrome
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With