3

I am about to look at building an extension for chrome that can listen to a particular http GET request, and then react by passing the body on to another application.

This will be limited to one website, and I am only concerned about the one request (though the query parameters can change)

The data will most likely be communicated to the other application using another GET or POST request by the extension.

I am new to most of the topics concerned with this issue. I have not used created a chrome extension before, though I see it has a lot of documentation which has helped greatly.

The question I am asking is how in a google chrome extension do I react to a GET request?

I am aware there is a network view in the dev tools, so I guess what I am asking is probably possible. I had guessed it may be done with an "Event" as listed here http://developer.chrome.com/extensions/events.html , but I cannot find the "onGET" event or similar

Thanks,

Luke

Luke Turner
  • 324
  • 1
  • 4
  • 22
  • 1
    possible duplicate of [Scrape / eavesdrop AJAX data using JavaScript?](http://stackoverflow.com/questions/13765031/scrape-eavesdrop-ajax-data-using-javascript) – Rob W Oct 18 '13 at 14:37
  • i don't agree, it's a whole different question – geevee Oct 18 '13 at 14:41
  • @GalV How do the questions differ? Both questions boil down to "How do I detect a HTTP request, and read the contents of its response body?" – Rob W Oct 18 '13 at 16:01
  • i'm sorry, i didn't understand the question well. – geevee Oct 18 '13 at 16:05

1 Answers1

2

It would appear that this is not particularly easy to do. There is an "onCompleted" callback with the chrome "webRequest" API, but that would not allow me access to the body.

What I have had to do to solve my issue, is get the plugin

https://chrome.google.com/webstore/detail/proxy-switchy/caehdcpeofiiigpdhbabniblemipncjj/related

And set up a proxy on my local machine. ProxySwitchy detects the request to the URL I care about, and uses my proxy instead. My proxy then duplicates the message and allows me to do with it as I please.

Luke Turner
  • 324
  • 1
  • 4
  • 22