Mike D3ViD Tyson
Mike D3ViD Tyson

Reputation: 1771

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. 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'); 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'...

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.

I'm using google chrome 65.0 and i have also tried to slow the load on the network tab but nothing.

Some ideas?

Upvotes: 3

Views: 3791

Answers (1)

jspcal
jspcal

Reputation: 51894

Set a breakpoint in chrome debugger or insert a debugger statement at the point in the script where you want to pause execution.

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. Go to Sources -> Event Listener Breakpoints -> Load -> unload in chrome dev tools.

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

Upvotes: 5

Related Questions