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 Desktop mode?
Below is my Android webview code
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_home);
wb=(WebView)findViewById(R.id.webView1);
CookieManager.getInstance().setAcceptCookie(true);
wb.getSettings().setLoadWithOverviewMode(true);
wb.getSettings().setUseWideViewPort(true);
wb.getSettings().setJavaScriptEnabled(true);
wb.getSettings().setAllowFileAccess(true);
wb.getSettings().setAllowContentAccess(true);
wb.setScrollbarFadingEnabled(false);
WebSettings settings = wb.getSettings();
settings.setDomStorageEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
wb.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedSslError(WebView v, SslErrorHandler handler, SslError er){
handler.proceed();
}
/*@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url != null && (url.startsWith("http://") || url.startsWith("https://"))) {
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
} else {
return false;
}
}*/
});
wb.loadUrl("https://cppt01.chartercom.com/pathtrak/direct/sa?node=30AA1E");
wb.setVisibility(View.VISIBLE);
}
Try this :