Force mobile version of website for WebView

前端 未结 1 868
北恋
北恋 2020-12-18 09:22

I\'m loading an URL into a webview to display it into my app. The problem I\'m encountering is, that not always the site recognizes that I\'m a phone (why so ever?). How exa

相关标签:
1条回答
  • 2020-12-18 10:15

    try to put these following lines :-

    webview.getSettings().setJavaScriptEnabled(true);
     webview.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"); 
    
    0 讨论(0)
提交回复
热议问题