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

查看:99
本文介绍了在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.

这是我尝试过的:

  • 开发人员工具->齿轮->常规->禁用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)",实快!它尚未重定向(是!)现在,我想在取消暂停之前禁用重定向行,但是该部分甚至还没有加载到Developer Tools中.因此,我将开始逐步浏览其他文件的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 (on the right sidebar) -> Load -> check unload

这将使调试器在导航之前分派的unload事件中断.

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

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

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