0

is there a way to get request and response objects from a webview?

for requests made from some webpage running in my webview, i want to intercept the full http request object(the headers, http method used, http body etc) and divert and send across that request into another channel.

For responses received from the webview, i want to do the same and get the object and its properties.

So far i have looked at the webviewClient android class which allows you to intercept url links executed by a webpage and intercept the resources it loads.

However, what i want to intercept, is any actual http requests the webpage makes. is this possible in Android webview?

thanks

1 Answer 1

0

That is not directly possible. You are welcome to write an HTTP proxy, then attempt to get WebView to work with that (e.g., see if it supports the http.proxyHost and http.proxyPort system properties).

1
  • At the moment, if i use onLoadResource i can get the url requests but not what the http request contains. any way of getting that from a webviewClients onLoadResource callback?
    – Jono
    Jun 21, 2013 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.