0

I'd like to rewrite the URL used for resource requests coming from an Android WebView. The hook that I see for doing things like that is to override shouldInterceptRequest on the WebView's WebViewClient. However, that method only provides a String url and does not provide access to the request details (headers, etc). As a result, it's impossible to know if a call is a GET or POST / an Ajax call / etc, etc.

Is there some other Android WebView hook that provides you with the chance to rewrite a resource URL while preserving the rest of the request?

On IOS it looks like you can provide a custom implementation of NSURLCache that could perform the rewriting. Is there anything similar on Android?

(Also, I'm actually using the Crosswalk browser rather than the stock webview - which is very similar in API to the standard Android WebView. I'd be interested in solutions for either crosswalk or the Android WebView.)

chwahoo
  • 61
  • 1
  • 2
  • 1
    I *hope* that's not possible. – Simas Aug 27 '14 at 17:34
  • @user3249477 - It sounds like you're raising a privacy concern. If you are interacting with a webview inside a third-party app, you have very little privacy protection in the first place - this feature certainly doesn't make it worse. In my use case, the url rewriting is for purposes that benefit the user. :) – chwahoo Aug 27 '14 at 17:54
  • Just wondering, did you find a solution? I am looking into the same problem :) – Kirill K Mar 13 '16 at 15:49

0 Answers0