I'm creating an aplication which involves an WebView. The truth is that I wish to load the entire page and never the mobile one, and so i have transformed the consumer Agent. Nonetheless you will find pages that loads the mobile version.
Listed here are two versions of code which i have attempted:
2. String DESKTOP_USERAGENT = webview.getSettings().getUserAgentString (); DESKTOP_USERAGENT = DESKTOP_USERAGENT.replace("Mobile ",""); webview.getSettings().setUserAgentString(DESKTOP_USERAGENT);
This are exemples of web pages that loads the mobile version in almost any cases:
1.Does anybody knows the way i can trick the server and simply tell him I'm utilizing a desktop and never a mobile? 2.So how exactly does an internet site knows that i'm utilizing a mobile version?
Thanks greatly, Razvan
The issue might be that if you work with a tool that the company is routing all of your HTTP demands via a proxy, which the proxy is altering the consumer-Agent. Check alternatively finish, with your personal server, using nc -l -p80 -vvv that the request is definitely delivering the consumer-Agent you have modified.
EDIT: Some specific troubleshooting steps
- Forward a port 9090 in your router for your desktop machine or laptop.
- Download netcat
- Run netcat using the command "nc -l -p9090 -vvv"
- Inside your Android application's WebView, make an HTTP request using the User-Agent you're inserting to http://your.ip.address:9090
- Within the terminal you went netcat, you will notice the HTTP request dump in plain text. There you should check the HTTP header User-Agent to ascertain if it's been transformed with a proxy server or otherwise.
You can't test these items with Wireshark or Fiddler since it is happening within the WAN. You have to test drive it around the receiving finish, either on the server, or by yourself desktop machine.