ajax 在 Chrome 中请求监控
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1820927/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Request Monitoring in Chrome
提问by Wes P
In Firefox, I use Firebug which allows me to view every http request my ajax calls are making. I've switched over my development to Chrome and am liking it so far. My only complaint, however, is that the developer tools don't seem to allow you to view each ajax request. I've had it happen once where the Resources panel showed multiple requests to the same resource, but it's only done it once and never again.
在 Firefox 中,我使用 Firebug,它允许我查看我的 ajax 调用发出的每个 http 请求。我已经将我的开发切换到 Chrome,到目前为止我很喜欢它。然而,我唯一的抱怨是开发人员工具似乎不允许您查看每个 ajax 请求。我曾经在资源面板显示对同一资源的多个请求的情况下发生过一次,但它只执行过一次,以后再也不执行了。
Is there a way to reliably see every http request that a page is making through javascript from within Chrome?
有没有办法从 Chrome 中可靠地查看页面通过 javascript 发出的每个 http 请求?
[Edit:11/30/09 11:55]
[编辑:11/30/09 11:55]
Currently, to get around this, I'm running Fiddler next to Chrome to view my requests, but if there's a way to do it from within the browser, I'd prefer that.
目前,为了解决这个问题,我在 Chrome 旁边运行 Fiddler 来查看我的请求,但如果有办法在浏览器中执行此操作,我更愿意这样做。
回答by Phil
I know this is an old thread but I thought I would chime in.
我知道这是一个旧线程,但我想我会插话。
Chrome currently has a solution built in.
Chrome 目前有一个内置的解决方案。
- Use
CTRL+SHIFT+I(or navigate toCurrent Page Control > Developer > Developer Tools. In the newer versions of Chrome, click the Wrench icon > Tools > Developer Tools.) to enable the Developer Tools. - From within the developer tools click on the
Networkbutton. If it isn't already, enable it for the session or always. - Click the
"XHR"sub-button. - Initiate an
AJAX call. - You will see items begin to show up in the left column under
"Resources". - Click the resource and there are 2 tabs showing the headers and return content.
- 使用
CTRL+SHIFT+I(或导航到Current Page Control > Developer > Developer Tools。在较新版本的 Chrome 中,单击扳手图标 > 工具 > 开发人员工具。)以启用开发人员工具。 - 从开发人员工具中单击
Network按钮。如果尚未启用,请为会话启用它或始终启用它。 - 单击
"XHR"子按钮。 - 启动一个
AJAX call. - 您将看到项目开始显示在 下的左栏中
"Resources"。 - 单击资源,有 2 个选项卡显示标题和返回内容。
回答by Wouter
The most up-to-date answer to this is: they are listed under the 'Network' button in the developer tools, no longer under 'Resources' like it used to be.
对此的最新答案是:它们列在开发人员工具的“网络”按钮下,不再像以前那样列在“资源”下。
回答by Karl Adler
Update
更新
Chrome changed how to inspect requests and suggests now to use the Catapult Netlog Viewerwith the logs exported from chrome://net-export/
Chrome 更改了检查请求的方式,并建议现在将Catapult Netlog 查看器与从chrome://net-export/导出的日志一起使用
chrome://net-export/
Old Chrome Versions
旧的 Chrome 版本
You also may use this link in Chrome for more detailed information than the inspector did it.
您也可以在 Chrome 中使用此链接获取比检查员所做的更详细的信息。
chrome://net-internals/#events
This shows the log of all requests of the browser while open
这显示了浏览器打开时所有请求的日志
回答by schellmax
don't know as of which chrome version this is available, but i found a setting 'Console - Log XMLHttpRequests' (clicking on the icon in the bottom right corner of developer tools in chrome on mac)
不知道这是哪个 chrome 版本可用,但我发现了一个设置“控制台 - 记录 XMLHttpRequests”(在 mac 上单击开发人员工具右下角的图标)
回答by ShaneDaugherty
Open up your DevTools and press F1 to access the settings. Look for the console section and check the checkbox for "Log XMLHttpRequests".
打开您的 DevTools 并按 F1 访问设置。查找控制台部分并选中“Log XMLHttpRequests”复选框。
Now all of your ajax and other similar requests will be logged in the console.
现在,您所有的 ajax 和其他类似请求都将记录在控制台中。
I prefer this method because it usually allows me to see everything that I'm looking for in the console without having to go to the network tab.
我更喜欢这种方法,因为它通常允许我在控制台中查看我正在寻找的所有内容,而无需转到网络选项卡。
回答by masoud2011
Thanks all person who try to help in this post
感谢所有试图在这篇文章中提供帮助的人
I have ubuntu 13.10 and my chrome version is 34.0
我有 ubuntu 13.10,我的 chrome 版本是 34.0
For my situation this works
对于我的情况,这有效
1.open developer tools in chrome(or use right click on your page and then select inspect element)
2.go to "Network" tab
3.find your ajax request in "Name Path" column
4.click on the specific ajax link
now you should see a new Panel in front of you request
现在您应该在您的请求前看到一个新面板
in this panel select "Response" tab
回答by wcb1
In the step 5 of Phil, "Resources" is no longer available in the new version of the Chrome. You need to click the page icon just beside the Ajax page listed in the bottom pane with the columns of Name, Method, Status, ...
在 Phil 的第 5 步中,“资源”在新版本的 Chrome 中不再可用。您需要单击底部窗格中列出的 Ajax 页面旁边的页面图标,其中包含名称、方法、状态等列。
Then it will show you more panels where you will find the error messages.
然后它将向您显示更多面板,您可以在其中找到错误消息。
回答by BitByteDog
You can also just right click on the page in the browser and select "Inspect Element" to bring up the developer tools.
您也可以在浏览器中右键单击页面并选择“检查元素”以调出开发人员工具。

