问题加载mobile.twitter在web视图视图、加载、问题、mobile

2023-09-13 01:51:16 作者:我想孤僻成性@

当我尝试加载以下URL在web视图我得到的是黑色的微博背景加载微调。在页面加载,如 WebViewClient.onPageFinished 被调用。然而,网页加载确定的标准Android浏览器。

When I try to load the following urls in a Webview all i get is black twitter background with loading spinner. The page is loaded, as WebViewClient.onPageFinished is called. However the page loads ok in the standard Android browser.

https://twitter.com/#!/scottyab or https://mobile.twitter.com/#!/scottyab

我想微博改变了他们的移动网站,因为这工作了一个月前。任何人遇到此?

I'm thinking Twitter changed their mobile website as this worked a month or so ago. Anyone else experiencing this?

更新时间:启用javascript mWebView.getSettings()setJavaScriptEnabled(真);

Updated: javascript enabled mWebView.getSettings().setJavaScriptEnabled(true);

推荐答案

通过硬编码的用户​​代理iPhone的用户代理修正了加载问题(我发现它的工作对iPhone版本的应用程序的)

Fixed the loading issue by hardcoding the user agent to iPhone's user agent (I found it worked on the iPhone version of the app)

mWebView.getSettings().setUserAgentString("Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3");

这需要一个肮脏的黑客后,洗我的手。

Need to wash my hands after this a dirty hack.