How to find where javascript is redirecting to another page?

General Tech Bugs & Fixes 3 years ago

5.73K 2 0 0 0

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago

I'm trying to debug an issue on complex javascript page in Chrome, where ultimately clicking on a link ends up redirecting to another page.

I'd like to find out where the code is that's actually doing the redirect, but can't seem to spot it.

I can see in the Network tab of DevTools that the Initiator was a certain bit of javascript, but when I click on that link and view the javascript, I don't see any window.location... references of any sort, and have tried debugging through the code, but can't find it.

Is there an easy way to detect when window.location is being used to redirect the page, even if it's being used in some wrapper library?

0 views
0 shares

profilepic.png
manpreet 3 years ago

 

 

This might help you, I have had this issue before:

  1. Open Developer Tools
  2. Go to Sources tab
  3. Look for Event Listener Breakpoints
  4. Expand Load option
  5. Here check unload option

Hope it helps! :)


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum