Chrome浏览器的Firebug的工艺来跟踪Ajax请求 [英] Chrome's firebug's technic to track ajax requests

查看:402
本文介绍了Chrome浏览器的Firebug的工艺来跟踪Ajax请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的谷歌浏览器的扩展,而浏览网页跟踪Ajax请求。只有这样,我发现是侦听DOMSubtreeModified事件。事件被触发的每一个AJAX事件,但没有关于请求的任何其他信息。但在Firebug的谷歌浏览器的扩展有Ajax请求有许多细节跟踪。我试图检查他们是如何做到这一点的源$ C ​​$ C,但对我来说很难理解。

I'm trying to make my google chrome extension to track ajax requests while browsing web. Only way i found is to listen for DOMSubtreeModified event. Event is fired on every single ajax event but there is no additional information about the request. But in Firebug google chrome extension there is ajax requests tracking with many details. I tried to check how they do it in the source code but it's hard for me to understand.

你知道如何追踪这些事件,以获取有关要求的一些细节? 也许有人可以看看这个Firebug的工艺或者也许有人知道它,能告诉我他们是如何做到的呢?

Do You know how to track those events to get some details about request? Maybe someone could take a look at this firebug's technic or maybe someone knows it and could tell me how they do it?

推荐答案

有一些事情你可以在Chrome开发者工具做调试AJAX请求:

There's a few things you can do with the Chrome Developer Tools for debugging AJAX requests:

  1. 网络选项卡。它跟踪所有(AJAX)的要求,他们的请求和响应头。
  2. 启用在devtools XHR控制台日志(右键单击开发人员工具控制台,然后单击启用XMLHtt prequest日志。
  3. 设置的<一个href="https://developers.google.com/chrome-developer-tools/docs/javascript-debugging#breakpoints-on-xhr">XHR断点。
  1. Look at the network tab. It tracks all (AJAX) requests, their request and response headers.
  2. Enable XHR console logging in the devtools (right-click in the Developer Tools console, and click "Enable XMLHttpRequest logging".
  3. Set an XHR breakpoint.

有没有必要对DOM断点在您的案件。另外,如果您的AJAX请求修改DOM树这种做法只会工作。

There's no need for DOM breakpoints in your case. Plus that approach would only work if your AJAX request modifies the DOM tree.

这篇关于Chrome浏览器的Firebug的工艺来跟踪Ajax请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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