Chrome for iOS User Agent on iPad

Have Chrome pretend to be an iPad

Browsers identify themselves by the 'user-agent' string in HTTP request header

You can change it https://chrome.google.com/webstore/detail/djflhoibgkdhkhhcedjiklpkjnoahfmg?hl=en-US&gl=US

iOS Chrome detection

According to Google Developers, the UA string looks like this:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3

Where it differs from iOS Safari in that it says CriOS instead of Version. So this:

if(navigator.userAgent.match('CriOS'))

Should do it.

Detect Browser on Ipad - Chrome or Safari

I got it working by using the http://useragentstring.com/pages/api.php.

var userAgent = Context.Request.Headers["User-Agent"];
var url = "http://www.useragentstring.com/?uas=" + userAgent + "&getText=agent_name";
HttpWebRequest req = HttpWebRequest.CreateHttp(url);

req.PreAuthenticate = true;
var res = req.GetResponse();
var text = "";
using (var sr = new StreamReader(res.GetResponseStream()))
{
text = sr.ReadToEnd();
}
res.Close();

if (text.Contains("Safari"))
{
//do stuff here
}

What is the iPad user agent?

Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10

Chrome on iOS 8 useragent no longer include crIOS

I discovered the answer just before posting. Apparently I'd clicked, some time ago, on this tab of Chrome and selected to "view the desktop version". This changes the userAgent to no longer indicate it is a mobile IOS version of the browser. The option was greyed out, though. I wasn't sure how to go back to the "Mobile" version. I found this URL:

https://support.google.com/chrome/answer/2664994?hl=en&topic=2365160&ctx=topic

The paragraph labeled: "Why can’t I go back to viewing mobile websites after enabling “Request Desktop Site”?" has the answer to this question.

Rather than making you go there yourself, it says that once you go to desktop mode on a particular tab it will remain set that way forever. To go back to a mobile view, you must close the tab and reopen a new one. New tabs default to the mobile userAgent/view.

Mystery solved.

Mimicking iPhone user agent in Chrome?

You can change chrome user agent by running it from command line:

chrome.exe --user-agent="User Agent String"

check out This Page for more information



Related Topics



Leave a reply



Submit