Android webview - referent set (for version <2.2 aka Froyo)

I have a mobile website and an Android mobile app that can download this website in a web view. I would like to set the HTTP “referer” request header from an Android application to keep track of what Android application users are doing.

Is there a way to set HTTP request headers before calling loadURL () in a WebView?

EDIT:

It turns out that in Froyo (2.2) there is a way to do this, since the loadUrl () command has a new parameter to specify additional WebView / loadUrl headers . The comments say that you cannot override common headers, but I tested the "referer" and it works great.

So, still need a pre Froyo solution - any ideas?

+5
source share
2 answers

This is not possible until Froyo. After Froyo, you can use the extraHeaders parameter in loadUrl to pass HTTP headers.

+1
source

you can install the user agent using the setUserAgentString (String ua) method

see WebSettings documentation: http://developer.android.com/reference/android/webkit/WebSettings.html

0
source

All Articles