简体   繁体   中英

Chrome: Set breakpoint on very first line

I have a webpage that is crashing in Chrome right at the point where the page loads.

How can I set a breakpoint before the page loads, so that I can habe a chance at understanding what causes the crash?

From what I understand of that error is that Chrome claims an error on line 1 because it failed to figure out where the error actually is. It wouldn't be possible for it to encounter an error at or before it has attempted to load the page because it would not have loaded the faulty code yet either.

Whenever I run into that situation, I sift through the code to try to see where I could have made a mistake. When it isn't obvious, try removing entire functions and see if it resolves the problem. If it does: figure out why that function is faulty.

If your code isn't monstrous, you could put it in a jsFiddle to have additional eyes look for the mistake.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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