简体   繁体   English

在响应页面脚本之前暂停[Chrome DevTools]

[英]Pause before response page script is called [Chrome DevTools]

I have this HTML page but i dont want to access to server-side source code. 我有此HTML页面,但我不想访问服务器端源代码。 this page have a basic POST form and when it was succesfull submitted it reload the same page with the script windows.location('someothersite.com'); 该页面具有基本的POST形式,成功提交后,将使用脚本windows.location('someothersite.com')重新加载同一页面 on the head, so the script was immediatly launched. 在头上,因此脚本立即启动。

it was a simple snippets 这是一个简单的片段

BEFORE : 之前:

 <form method="POST">
        <input type="password" name="password"><br><br>
        <input type="submit" value="Submit">
 </form>

AFTER SUCCESSFUL SUBMIT : 成功提交后:

<script>windows.location('someothersite.com');</script>

so, the server load the same page with this script inside (this is a really basic example just for make easyest to understand what's my issue) and i will be immediatly redirect to 'someothersite.com'... 因此,服务器在其中加载了带有此脚本的同一页面(这是一个非常基本的示例,仅是为了最容易理解我的问题), 我将立即重定向到“ someothersite.com” ...

i want to intercept and pause the page before script was launched to prevent the redirection. 我想在脚本启动前拦截并暂停页面,以防止重定向。

i tried to push F8 but nothing happened because the first page have not js inside and the second page is too fastly to let me hit F8 or put some breackpoint on the source code. 我试图推动F8,但没有任何反应,因为第一页内部没有js,第二页太快了,无法让我命中F8或在源代码上放置一些breackpoint。

I'm using google chrome 65.0 and i have also tried to slow the load on the network tab but nothing. 我正在使用Google Chrome 65.0,并且我也尝试过减慢网络标签上的负载,但没有任何反应。

Some ideas? 有什么想法吗?

Set a breakpoint in chrome debugger or insert a debugger statement at the point in the script where you want to pause execution. 在chrome调试器中设置断点,或在脚本中要暂停执行的位置插入debugger语句。

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger

You can also set a breakpoint on the unload event which occurs right before navigation. 您还可以在导航之前立即发生的unload事件上设置断点。 Go to Sources -> Event Listener Breakpoints -> Load -> unload in chrome dev tools. 在chrome dev工具中转到Sources -> Event Listener Breakpoints -> Load -> unload

https://developers.google.com/web/tools/chrome-devtools/javascript/breakpoints#event-listeners https://developers.google.com/web/tools/chrome-devtools/javascript/breakpoints#event-listeners

Enable "Preserve log upon navigation" in the console settings to keep the breakpoints across page loads: 在控制台设置中启用“在导航时保留日志”,以使断点保持在页面加载中:

https://developers.google.com/web/tools/chrome-devtools/console/#additional_settings https://developers.google.com/web/tools/chrome-devtools/console/#additional_settings

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

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