DOM 加载断点
我试图在我无法控制的网站上使用一个非常旧的页面(所以我无法编辑它的资源)。
问题是它通过 javascript 重定向页面(到“我们不支持此浏览器”垃圾),通过设置 document.location,然后我可以设置任何断点来进行调试/解决方法。
DOM 加载后是否可以立即中断,最好是在 Chrome 中?
禁用 javascript 会停止重定向,但 chrome 不允许我查看任何脚本来放置断点。
I am trying to use a really old page on a website I do not have control over (so I can't edit it's resources).
The problem is that it is redirecting the page via javascript (to a 'we don't support this browser' rubbish), via setting document.location before I can set any breakpoints to then debug/workaround.
Is it possible to break as soon as the DOM loads, preferably in chrome?
Disabling javascript stops the redirect, but chrome does not allow me to view any scripts to then place break points.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
FireBug 具有“Break On Next”功能。我不确定它是否适合您的情况,但可能值得快速尝试一下: https://getfirebug.com/doc/breakpoints/demo.html#suspend
FireBug has a "Break On Next" feature. I'm not sure if it will work in your case, but it might be worth giving it a quick try: https://getfirebug.com/doc/breakpoints/demo.html#suspend
Chrome 似乎喜欢做一些事情来阻止您在页面完成加载之前单击停止按钮时看到代码。它会显示类似
window.script123456738391=1;
的内容。这使得您无法在代码内的正确位置设置断点,特别是如果在您有机会暂停页面之前页面上存在重定向。我发现你可以做的是在第一行设置一个断点。下次加载页面时,无论它是什么,它都会在第一行中断。然后您可以看到页面将加载的所有代码并在您想要的任何地方设置断点:)
It seems like Chrome likes to do something to prevent you from seeing the code when you click the stop button before the page finishes loading. It'll say something like
window.script123456738391=1;
. That makes it so you can't set a breakpoint at the right spot inside the code, especially if there's a redirect on the page before you get a chance to pause it.What I found you can do is set a breakpoint on that first line. Next time you load the page it will break on the very first line, regardless of what it is. Then you can see all the code the page would load and set breakpoints wherever you want :)