设置web视图以查看桌面网站,而不是移动网站网站、视图、而不是、桌面

2023-09-12 08:17:33 作者:人生若只如初见。

我对堆栈溢出做了相当多的研究和大量谷歌的研究,但没有的,我觉得实际上是工作对我来说。我希望自己的网站查看手机网站的桌面版网站,而不是。我该怎么做呢?我希望它直接到桌面的网站。

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

解决方案

改变web视图的用户代理

 字符串newUA =富/; //根据需求改变UA
 

喜欢

 字符串newUA =Mozilla的/ 5.0(X11; U; Linux的i686的; EN-US; rv中:1.9.0.4)的Gecko / 20100101火狐/ 4.0;
 。mWebView.getSettings()setUserAgentString(newUA);
 
教育机构移动端网页设计落地页图片

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

解决方案

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

 
精彩推荐
图片推荐