Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebView user agent

I have WebView which loads one mobile site, I need send to user agent to the server how it to realize?

mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true); 
mWebView.loadUrl("http://searchmp3.mobi/");   
mWebView.setWebViewClient(new HelloWebViewClient());
like image 728
Ramin Avatar asked Jun 30 '12 09:06

Ramin


People also ask

What is WebView used for?

Android WebView is a system component for the Android operating system (OS) that allows Android apps to display content from the web directly inside an application.

How do I change User-Agent in Android WebView?

If you would like to experiment with a custom User-Agent in the standalone Browser application (not an embedded WebView inside an application), you can manipulate the User-Agent value by typing "about:useragent" in your browser's URL field (without the quotes ""), and then load the page.

Is Android WebView spyware?

Is Android System WebView spyware? Many curious people think that it is a spy app, which it is not. It is a browser software integrated into an operating system and allows programs to access websites. You can access any kind of material by using the assistance of WebView.

What is a web User-Agent?

A user agent is any software that retrieves and presents Web content for end users or is implemented using Web technologies. User agents include Web browsers, media players, and plug-ins that help in retrieving, rendering and interacting with Web content.


1 Answers

Checkout the setUserAgentString() method in the WebSettings, e.g.

mWebView.getSettings().setUserAgentString("My user agent string, here");
like image 156
Jameson Avatar answered Nov 15 '22 08:11

Jameson