设置 WebView 以查看桌面站点而不是移动站点 [英] Setting WebView to view Desktop Site and Not Mobile Site

查看:29
本文介绍了设置 WebView 以查看桌面站点而不是移动站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Stack Overflow 和 Google 进行了大量研究,但我发现没有任何东西对我有用.我希望该站点查看桌面站点而不是移动站点.我该怎么做呢?我希望它直接转到桌面站点.

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/");
}

推荐答案

更改webview的用户代理

Change the user agent of webview

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

喜欢

 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);

这篇关于设置 WebView 以查看桌面站点而不是移动站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆