Force Mobile Version Of Website For Webview
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 exactly do I
Solution 1:
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");
Solution 2:
I know I am too late to the party. But, hoping it will help someone who is still facing the same problem, I will write my solution here.
The accepted answer didn't work for me. The following does.
Java:
webView.getSettings().setJavaScriptEnabled(true)
webView.getSettings().setUseWideViewPort(true)
Kotlin:
webView.settings.javaScriptEnabled = truewebView.settings.useWideViewPort = true
Post a Comment for "Force Mobile Version Of Website For Webview"