Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping all javascript execution

Is there an equivalent to the php die() function for javascript that stops all javascript (including future callbacks for ajax requests, timeouts etc...) from running?

(NOTE: I can't use breakpoints in the debugger as the bug is in ie8 and the debugger prevents you from scrolling up/down the page while at a breakpoint; to be able to see at which point the bug is occurring I need to be able to scroll the page while the code is stopped)

like image 231
wheresrhys Avatar asked Apr 20 '11 09:04

wheresrhys


People also ask

How do I stop JavaScript from running?

Press Control+Shift+P or Command+Shift+P (Mac) to open the Command Menu. Start typing javascript , select Disable JavaScript, and then press Enter to run the command. JavaScript is now disabled.

How do you stop a function execution?

When you click Call the function button, it will execute the function. To stop the function, click Stop the function execution button.

Does JavaScript error stop execution?

JavaScript Errors and generic handling. throw new Error('something went wrong') — will create an instance of an Error in JavaScript and stop the execution of your script, unless you do something with the Error.


1 Answers

Yes, it can be done. This will end execution of the javascript.

throw new Error('');

like image 165
Alasdair Avatar answered Nov 04 '22 01:11

Alasdair