Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android webview - set referer (for version < 2.2 aka Froyo)

I have a mobile web site and a mobile app for Android that can load this web site in a webview. I'd like to set the HTTP 'referer' request header from the Android app so that I track what Android app users do.

I there any way to set the HTTP request headers before calling loadURL() in WebView ?

EDIT:

It turns out in Froyo (2.2) there is a way to do this as the loadUrl() command has a new parameter to specify extra headers WebView/loadUrl. The comments say you can't override common headers, but I've tested 'referer' and it works fine.

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

like image 260
Kevin Avatar asked Nov 14 '22 05:11

Kevin


1 Answers

It is not possible pre Froyo. After Froyo you can use the extraHeaders parameter in loadUrl to pass HTTP headers.

like image 87
Kevin Avatar answered Jan 03 '23 08:01

Kevin