A
A
Anton Vertov2018-02-01 12:40:16
Java
Anton Vertov, 2018-02-01 12:40:16

How to show Desktop version in WebView instead of Mobile?

Good day. I have a WebView element in my app, and I'm trying to navigate to a website.
My task is to display the desktop version of the site, not the mobile one. User-Agent changed like this:

mWebView.getSettings().setUserAgentString("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/602.3.12 (KHTML, like Gecko) Version/10.0.2 Safari/602.3.12");

But nothing comes out. The problem is in css media queries. They determine the width of the screen and show the mobile layout.
How can I fool these media queries and let the site know that I have a large (desktop) resolution so that it shows the desktop version?
Tried to twist the settings in different ways - it does not work.
mWebView.getSettings().setUseWideViewPort(false);
        mWebView.getSettings().setLoadWithOverviewMode(false);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question