Question

I was wondering if is it possible to make a mobile device look like a computer to a web page.

For example, the web site Spotify checks if you are visiting the page from a computer or a mobile device. If you're from computer you can play music and use the website's function free, else you'll see something like "download our application" (and you have to pay a premium account to use its complete options).

I'm just curious, could an application like this be made? (maybe it already exists and I simply don't know)

I didn't know in which categories insert this question (since I don't have any knowledge of mobile-development), any advice is well accepted!

Was it helpful?

Solution

This should probably be on Super User since it's not specifically a programming question, however you do ask if such an application can be made, so...

It depends on the user agent string the browser includes on the HTTP request. By default, this indicates a mobile user hence you get the mobile page. Some browsers have a 'View Desktop Site' option that adjusts the user agent so it appears that the request is coming from a desktop browser. Note that choosing that option (if available) is not guaranteed to always work.

For Android (don't know about iOS), you can do this yourself with an Activity using a WebView. The code below makes the webview pretend to be a desktop Firefox browser:

String ua = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0"
mWebview.getSettings().setUserAgentString(ua);

Fyi, the above code is taken from question Want to load desktop version in my webview using uastring

OTHER TIPS

The easiest way of masking your device is changing your user-agent string. You can google how to do that. If the sites algorithm only detects the user-agent string then you can mask it. But if their algorithm goes deeper to other things about the device such as the resolution your viewing the site, your browser settings. etc.. then it'll be a lot harder.

In practice many sites only check the user-agent string though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top