WebView User Agent

I have a WebView that loads one mobile site, I need to send the user agent to the server, how to implement this?

mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl("http://searchmp3.mobi/"); mWebView.setWebViewClient(new HelloWebViewClient()); 
+6
source share
2 answers

Check out the setUserAgentString() method in WebSettings , for example

 mWebView.getSettings().setUserAgentString("My user agent string, here"); 
+17
source

try this one

  WebView wv = (WebView) findViewById(R.id.webview1); WebSettings webSettings = wv.getSettings(); webSettings.setBuiltInZoomControls(true); wv.loadUrl("http://www.google.com"); 
-3
source

Source: https://habr.com/ru/post/919381/


All Articles