Stopping all javascript execution

試著忘記壹切 提交于 2019-12-07 05:59:23

问题


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)


回答1:


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?

No.

That's all there is to say, really.




回答2:


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

throw new Error('');




回答3:


debugger;

in console to pause execution (at least in chrome)



来源:https://stackoverflow.com/questions/5728266/stopping-all-javascript-execution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!