简体   繁体   English

在JavaScript中跟踪对window.location的更改

[英]Tracing changes to window.location in JavaScript

I have a webapp which is doing a weird, wrong, unexpected redirection through JavaScript (I checked that by disabling JavaScript in the browser. Redirection doesn't happen). 我有一个webapp正在通过JavaScript执行奇怪,错误,意外的重定向(我通过在浏览器中禁用JavaScript进行了检查。重定向不会发生)。 I've also checked all the JavaScript code for window.location being set and put breakpoints on it, but it still didn't tell me who did the redirect. 我还检查了所有JavaScript代码是否设置了window.location并在其上设置了断点,但是它仍然没有告诉我谁进行了重定向。

I don't want to add processing before or after redirections, I need to know which code triggered the redirection so I can disabled it. 我不想在重定向之前或之后添加处理,我需要知道哪个代码触发了重定向,因此可以禁用它。

There's several methods to do navigation in Javascript. 有几种方法可以用JavaScript进行导航。 Check 校验

  • window.location or document.location window.location或document.location
  • window.navigate (only in some browsers) window.navigate(仅在某些浏览器中)
  • window.history 窗口历史

See eg https://developer.mozilla.org/en-US/docs/DOM/window.history or https://developer.mozilla.org/en-US/docs/DOM/Manipulating_the_browser_history on history, and https://developer.mozilla.org/en-US/docs/DOM/window.location on window.location 有关历史记录,请参见例如https://developer.mozilla.org/en-US/docs/DOM/window.historyhttps://developer.mozilla.org/en-US/docs/DOM/Manipulating_the_browser_historyhttps:// /developer.mozilla.org/zh-CN/docs/DOM/window.location在window.location

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM