最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Getting all HTTP headers and traffic programmatically in Chrome - Stack Overflow

programmeradmin1浏览0评论

I need to get a frame's HTTP headers programmatically from Javascript. It doesn't need to be portable (I only need it for Chrome) and I don't mind having to add/write a specific extension.

Or, even better and more importantly, I need to have access to all network traffic from and to a specific site programmatically as it happens.

Is there a way to do this? Do I need to write my own extension to make it happen? And if so, can I write the extension in Javascript?

Writing an extension seems to be the only way to go. I could write one and use the chrome.* API like here: If writing an extension is the way to go, how would you go about it?

I need to get a frame's HTTP headers programmatically from Javascript. It doesn't need to be portable (I only need it for Chrome) and I don't mind having to add/write a specific extension.

Or, even better and more importantly, I need to have access to all network traffic from and to a specific site programmatically as it happens.

Is there a way to do this? Do I need to write my own extension to make it happen? And if so, can I write the extension in Javascript?

Writing an extension seems to be the only way to go. I could write one and use the chrome.* API like here: https://developer.chrome./extensions/devtools_network If writing an extension is the way to go, how would you go about it?

Share Improve this question edited Jun 28, 2014 at 20:16 Sam 7,39816 gold badges47 silver badges68 bronze badges asked Apr 13, 2014 at 11:41 MercMerc 17.1k18 gold badges84 silver badges132 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

The chromework.devtools API can only be used in a devtools extension, which is only active when the devtools for a page has been opened.

With the chrome.webRequest extension API, you can access the following information:

  • Request headers (read / modify)
  • Request body (read-only, editing not (yet) implemented)
  • Response headers (read / modify)
  • Response body (reading / editing not implemented yet)

Requests can be filtered by URLs, request types and per tab/window.

These APIs are only available to extensions, so you have to develop a Chrome extension. Read the Getting started tutorial to get started.

发布评论

评论列表(0)

  1. 暂无评论