Chrome debugger inserts javascript

I have this curiosity

Is it possible to somehow insert javascript into my page and execute it and debug it? Like in the console, but in the console you cannot pause and view variables.

Is it possible to debug the code that I run through the console? Why is it impossible to debug code received through XHR?

Thanks!

+8
javascript debugging google-chrome
source share
2 answers

One trick I learned today from Chromium is that if you put the word:

debugger; 

Right in front of the statement you want to debug. It will break on the debugger. This is really useful for injected scripts.

+11
source share

yes, you can enable the javascript function on our web page using

 window.onload = function fun(){alert("test");} 

in this case u can give an operator or any function.

0
source share

All Articles