Spoofing

Some websites will deliver different content to different programs that ask for the same page. In extreme cases, a website may deny access completely to some programs. When this happens, you can try to gain access to the site by “spoofing” as another browser.

A client browser sends a special string, called a user agent, to websites to identify itself. The web server or JavaScript in the downloaded webpage, detects the client’s identity and modifies its behavior accordingly. In the simplest case, the string includes an application name (for example, “Navigator”) and version information (for example, 4.7 or 6.0). You can use these user-agent methods in WebView to make the identity of your application known and in some cases, to hide the identity of your application, a technique called spoofing:

Note that some websites use the user-agent string to determine whether they support a client browser or not. If they don’t, they may send dumbed-down versions of pages or deny access to the website too. In that case, you can modify the user-agent string to pretend to be a popular browser and then access the website. Although, this may not work if the website expects your application to implement browser-specific extensions. For this reason, you should only consider spoofing as a last resort.