在 Chrome 中的内联 javascript 重定向之前中断 javascript [英] Break javascript before an inline javascript redirect in Chrome

查看:24
本文介绍了在 Chrome 中的内联 javascript 重定向之前中断 javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看具有内联 JavaScript 重定向的页面 (window.location = "/anotherpage").我想在 Chrome 中加载页面,但禁用了重定向行,因此我可以使用该页面而不会被重定向.

I'm viewing a page that has an inline javascript redirect (window.location = "/anotherpage"). I want to load the page in Chrome but have the redirect line disabled, so I can use the page without getting redirected away.

这是我尝试过的:

  • 开发者工具 -> Cog -> 通用 -> 禁用 JavaScript.加载页面.它不会重定向(是的!).但我仍然希望页面的其余 javascript 运行,但它没有.

  • Developer tools -> Cog -> General -> Disable JavaScript. Load the page. It doesn't redirect (yay!). But I still want the rest of the page's javascript to run, and it hasn't.

输入 URL,然后点击开发者工具 -> 来源 -> 暂停 (F8) 真的很快!它尚未重定向(是的!)现在我想在取消暂停之前禁用重定向行,但该部分甚至还没有加载到开发人员工具中.所以我将开始逐步完成其他文件的 javascript 代码,直到我到达那里??但是一旦我退出其他文件 javascript,它就会立即重定向(doh!).

Type the URL, then click Developer tools -> Sources -> Pause (F8) real fast! It hasn't redirected yet (yay!) Now I want to disable the redirect line before unpausing, but that part hasn't even loaded yet into Developer Tools. So I'll start stepping through the other files javascript code until I get there?? But as soon as I step out of the other files javascript, it immediately redirects away (doh!).

这能做到吗?我认为禁用一行 javascript 应该很容易,但我很难过.

Can this be done? I thought it should be easy to disable a line of javascript, but I'm stumped.

推荐答案

Developer Tools -> Sources -> Event Listener Breakpoints(在右侧边栏)-> Load -> check unload

Developer Tools -> Sources -> Event Listener Breakpoints (on the right sidebar) -> Load -> check unload

这将使调试器在导航前调度的卸载事件上中断.

This will make debugger break on unload event which is dispatched before navigation.

这篇关于在 Chrome 中的内联 javascript 重定向之前中断 javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆