Why doesn't the JavaScript debugger stop at the debugger instruction?

I expect when I inject a JavaScript debugger expression into my JavaScript code that the program stops at that point and the debugger opens, showing a "breakpoint".

I do not see this at all.

Here is my code.

<html> <script type="text/javascript"> debugger; alert("Hello world!") </script> <body> <p>Hello world</p> </body> </html> 

When I run it, I go straight to the alert popup. What step am I missing?

My question is: Why does the JavaScript debugger not stop in the debugger instruction?

(Just to clarify - I had the developer tools open, but on the console tab, not on the Sources tab.)

+5
source share
2 answers

You need to open Developer Tools before executing the debugger; .

Open with the F12 key (read this for more features)


See in action:

Developer Tools do not open

enter image description here


Developer Tools open

enter image description here

http://jsfiddle.net/qkd5swv9/

+5
source

It looks like Chrome is not pausing in debugger; statements debugger; when JS code is minimized. However, I do not have the source maps.

+3
source

Source: https://habr.com/ru/post/1213853/


All Articles