Chrome 的 firebug 技术用于跟踪 ajax 请求
我正在尝试让我的 google chrome 扩展程序在浏览网页时跟踪 ajax 请求。我发现的唯一方法是监听 DOMSubtreeModified 事件。每个 ajax 事件都会触发事件,但没有有关请求的附加信息。但在 Firebug google chrome 扩展中,有 ajax 请求跟踪,其中包含许多详细信息。我试图在源代码中检查他们是如何做到这一点的,但我很难理解。
您知道如何跟踪这些事件以获取有关请求的一些详细信息吗? 也许有人可以看看这个萤火虫的技术,或者也许有人知道它并可以告诉我他们是如何做到的?
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.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Chrome 开发者工具执行以下操作来调试 AJAX 请求:
在您的情况下不需要 DOM 断点。此外,只有当您的 AJAX 请求修改时,该方法才有效DOM 树。
There's a few things you can do with the Chrome Developer Tools for debugging AJAX requests:
There's no need for DOM breakpoints in your case. Plus that approach would only work if your AJAX request modifies the DOM tree.
目前,无法以编程方式获取有关 ajax 请求的所有信息,类似于“网络”选项卡。
有实验性
chrome.experimental.webRequest.onCompleted .addListener
,用它你可以捕获ajax请求,获取返回的响应代码(200,404),并获取一些响应头。您将无法获得响应正文。Currently there is no way of programmatically getting all info about ajax requests similar to Network tab.
There is experimental
chrome.experimental.webRequest.onCompleted.addListener
, with it you can catch ajax request, get returned response code (200,404), and get some response headers. You won't be able to get response body.