Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User Agent for Safari browser on iOS 7

Tags:

browser

ios

I want to open my site only in iPhone and iPod with Safari browser. For any other browser like Chrome, Dolphin, etc, It shouldn't open.

But currently I am getting the same user agent from almost all the devices:

For Safari:

User Agent String :: mozilla/5.0 (iphone; cpu iphone os 7_0_2 like mac os x) applewebkit/537.51.1 (khtml, like gecko) version/7.0 mobile/11a501 safari/9537.53

For Chrome:

User Agent String :: mozilla/5.0 (iphone; cpu iphone os 7_0_2 like mac os x) applewebkit/537.51.1 (khtml, like gecko) crios/30.0.1599.16 mobile/11a501 safari/8536.25

For Mercury browser:

User Agent String :: mozilla/5.0 (iphone; cpu iphone os 6_0_1 like mac os x) applewebkit/536.26 (khtml, like gecko) mercury/7.4.2 mobile/10a523 safari/8536.25

For Dolphin browser:

User Agent String :: mozilla/5.0 (iphone; cpu iphone os 7_0_2 like mac os x) applewebkit/537.51.1 (khtml, like gecko) version/6.0 mobile/10a523 safari/8536.25

With Chrome I can see by checking for crios, and Mercury by mercury string, but what about the other browsers which seem to have same user agent as Safari?

like image 847
Novice User Avatar asked Oct 09 '13 05:10

Novice User


People also ask

How do I enable user agent in Safari?

Here uncheck the checkbox next to the Use browser default option in the User-agent section. Afterward, click on the user-agents menu here, and a list of user-agents will open up. This includes old Android versions, Microsoft Edge, Opera, Firefox, Chrome, Safari, and UC Browser on different operating systems.

Where is user agent in Safari?

Safari on macOS To do that, open the Safari menu > Preferences > Advanced tab. At the bottom of the window, check the box Show Develop menu in menu bar. Click the Develop > User Agent, then choose the desired web browser.

How do I change user agent in Safari on iPad?

It's not possible to change your user agent string on iPhone. The user agent string you provided is the standard string that an iPhone uses; nothing out of the ordinary there.


2 Answers

The other answer isn't strictly correct. On iOS, Apple block any competing browsers from actually including their own rendering engine; all must use the standard webview.

So all of those 3rd party browsers (with functionality such as syncing favourites, etc.) are simply wrappers around the Safari powered webview that's actually rendering the page, hence them all having Safari's user agent string.

like image 111
Andy Nugent Avatar answered Oct 19 '22 06:10

Andy Nugent


The browsers do this very deliberately to prevent people from doing what you're trying to do. Their developers feel that since they're using the same web engine (WebKit, blink or gecko) as the others that they'll lkely render pages optimized for similar browsers just fine (which is likely true).

So most likely there is no way to tell.

like image 26
ksimons Avatar answered Oct 19 '22 08:10

ksimons