user2039764 user2039764 - 1 month ago 28
Android Question

Setting WebView to view Desktop Site and Not Mobile Site

I've done quite a lot of research on Stack Overflow and a lot of Google research but nothing I find is actually working out for me. I want the site to view the desktop site instead of the mobile site. How do I do this? I want it to directly go to the Desktop site.

WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl("http://www.apotter96.webs.com/");
}

Answer

Change the user agent of webview

 String newUA="Foo/"; // Change this to desired UA

like

 String newUA= "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
 mWebView.getSettings().setUserAgentString(newUA);
Comments