Reputation: 31893
is it possible with javascript to listen for and capture outgoing HTTP requests? (For example, AJAX calls). Sort of like firebug, etc
Upvotes: 9
Views: 10540
Reputation: 21842
If you want to capture all HTTP requests, I would suggest using Charles. Its an awesome tool which works as proxy and gives result in human readable form.
Shows Request, Response, Time Chart. The request is shown with headers. Response is shown with headers along with content. Worth trying it.
Upvotes: 1
Reputation: 284836
Sure, you can trace AJAX requests on your own pages. Make a wrapper for the XMLHttpRequest constructor that records the information you're interested in.
EDIT: An extension lets you observe internal browser operations. For example, you can see in Firebug's source that it observes all of Firefox's HTTP topics. These are "http-on-modify-request", "http-on-examine-response", and "http-on-examine-cached-response."
Upvotes: 5
Reputation: 129792
Nope, not like firebug. The closest thing you can do, if you're using a framework such as jQuery or Microsoft AJAX.NET, you can be notified when an AJAX request is issued through that specific framework.
For jQuery, that's .ajaxStart()
There are heaps of requests that this won't catch, though, such as all requested assets (script files, images, etc.)
Upvotes: 6