Вопрос

I faced issue of android webview not supporting websockets , then I tried to change its useragent , hoping that it would work. But It didn't.

I searched and found out that websockets are not supported and I have to use some library.

But what does changing useragent means ? Is it just notifying the browser name ? or it has some influence on browsers performance ?

Это было полезно?

Решение

A user agent is a string that identifies the client software that is trying to access the resources of a server. Consider the following agent:

Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; Nexus One Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1

This agent informs the server that it is a Nexus One device running Froyo and the locale is in English.

The user agent does not affect performance. It is used by servers to identify the client platform. If a server can identify the client platform correctly, it can send it appropriate resources depending on the client's capabilities. It can, for example deliver pages in a different language depending on where the client is located.

Другие советы

But what does changing useragent means ?

Every browser has a user agent string that tells the website, what browser you are using.

That's my user agent string for my Safari browser:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko)

So, by modifying the user agent string you can manipulate the way the site reacts to you.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top