0

I'm uploading a URL to CustomTabs. I want to enable pinch zoom in CustomTabs. By default it does not enable zoom pinch, but if you go to the menu and tapDesktop Site, enable pinch zoom.

I want to know that if there is a way to open Desktop site by default when the user launches a web URL from my app.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
dev90
  • 7,187
  • 15
  • 80
  • 153

1 Answers1

2

Checkout this answer... I've tried this and it works well

How to open desktop site in webview in android

You can set user agent for your webView programmatically

In case something happens to the link, here's the answer for your question from that link:

private static final String DESKTOP_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36";
private static final String MOBILE_USER_AGENT = "Mozilla/5.0 (Linux; U; Android 4.4; en-us; Nexus 4 Build/JOP24G) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";

//Choose Mobile/Desktop client.
WebSettings settings = mWebView.getSettings();
settings.setUserAgentString(DESKTOP_USER_AGENT);
Arshdeep Singh
  • 316
  • 4
  • 15