Chrome调试器注入javascript [英] Chrome debugger inject javascript

查看:172
本文介绍了Chrome调试器注入javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个好奇心,

在某种程度上,是否可以在我的页面中注入javascript并执行它并进行调试?与控制台一样,但是在控制台中,您无法暂停和观察变量。

Is it, in some way, possible to inject javascript in my page and execute it and debug it? As you do with the console, but in the console you can't pause and watch variables.

是否可以调试通过控制台的代码?
为什么不能调试通过XHR收到的代码?

Is it possible to debug code that i put through console? Why isn't it possible to debug code received via XHR?

谢谢!

推荐答案

今天从Chromium学到的一个技巧是,如果你放了这个词:

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

debugger;

正好在您要调试的语句之前。它会破坏调试器。这对于注入的脚本非常有用。

Right before the statement you want to debug. It will break on the debugger. It is really useful for injected scripts.

这篇关于Chrome调试器注入javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆