Javascript 在调用响应页面脚本之前暂停[Chrome DevTools]
我有这个HTML页面,但我不想访问服务器端源代码。 此页面有一个基本的POST表单,当它成功提交时,将使用脚本重新加载同一页面windows.location('someothersite.com')在头部,因此脚本立即启动 这是一个简单的片段 之前:Javascript 在调用响应页面脚本之前暂停[Chrome DevTools],javascript,redirect,google-chrome-devtools,Javascript,Redirect,Google Chrome Devtools,我有这个HTML页面,但我不想访问服务器端源代码。 此页面有一个基本的POST表单,当它成功提交时,将使用脚本重新加载同一页面windows.location('someothersite.com')在头部,因此脚本立即启动 这是一个简单的片段 之前: <form method="POST"> <input type="password" name="password"><br><br> <input typ
<form method="POST">
<input type="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
<script>windows.location('someothersite.com');</script>
成功提交后:
<form method="POST">
<input type="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
<script>windows.location('someothersite.com');</script>
windows.location('someothersite.com');
因此,服务器加载相同的页面,其中包含此脚本(这是一个非常基本的示例,只是为了便于理解我的问题)
而我将立即重定向到“someothersite.com”
我想在启动脚本之前拦截并暂停页面,以阻止重定向。
我试着按F8,但什么也没发生,因为第一页里面没有js,第二页太快了,无法让我按F8或在源代码上添加一些breackpoint
我正在使用google chrome 65.0,我也尝试过减缓网络标签上的负载,但什么都没有
一些想法?在chrome debugger中设置一个断点,或者在脚本中要暂停执行的位置插入一条
debugger
语句
您还可以在导航之前发生的unload
事件上设置断点。进入chrome开发工具中的Sources->Event Listener Breakpoints->Load->unload
在控制台设置中启用“导航时保留日志”,以在页面加载时保持断点:
这是该页面的全部源代码,其中没有脚本:您认为我必须将breackpoint放在哪里?您可能需要在控制台设置中启用“导航时保留日志”。