Skip to content Skip to sidebar Skip to footer

Enable Only Desktop Mode In Android Webview

I am trying to enable only Desktop mode of a website in android webview in android device. But it renders only in mobile view. Is there any way I can force the view to be only in D

Solution 1:

Try this :

 * private static final String desktop_mode = "Mozilla/5.0 (X11; Linux x86_64) 
   AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36";

* private static final String mobile_mode = "Mozilla/5.0 (Linux; U; Android 4.4; en- 
  us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile 
  Safari/534.30";


 //Choose Mobile/Desktop mode.

 WebSettings settings = mWebView.getSettings();
 settings.setUserAgentString(desktop_mode );

Post a Comment for "Enable Only Desktop Mode In Android Webview"