user agent of iPhone doesn't contain iPhone string - iphone

To ensure users use iPhones to access web application, I check user agent in the http request. Some times I found there is no iPhone string in it . the caught user agent is
mozilla/5.0 (macintosh; intel mac os x 10_15_6) applewebkit/605.1.15 (khtml, like gecko) version/14.0 safari/605.1.15
the tag is macintosh not iPhone. As I know , macintosh represent a computer not a mobile.
But the user told me he used iPhone to access system. Did he use a fake iPhone mobile ?

Related

What is the best way to determine iOS 7 Safari user agent?

I'm having a styling issue that only exists in the iOS 7 versions of Safari. I have been unable to determine how to detect if the user is on that device with CSS Media queries or what the exact user agents are for iOS 7 devices.
Any help?
Just try:
navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 7_\d/i)
IPhone/iOS7 user agent string looks like this:
Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53

What's the iPad User Agent of iPhone App when emulated in iPad in UIWebView

Will a user agent of an iPad running an iPhone app with a UIWebView use a iPad User Agent, or an iPhone user agent?
The default User-Agent the UIWebView on iPad uses is:
Mozilla/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B141
Yes, it is an iPad User-Agent.
You can check your User-Agent string by going to:
http://jonathangurebo.com/detect
or
http://whatsmyuseragent.com
if you wan't to change your User-Agent in UIWebView, check this link: Change User Agent in UIWebView (iPhone SDK)

What is the user agent of an iPhone that does not have 4.0+?

Can someone give examples?
I know that iPhone 4.2.1 has "4_2" inside the user agent.
What about other models?
Can someone help?
Google is your friend. It's easy to find a definitive list of Safari user agent strings, of which many are Mobile Safari on iPhone. An example pre-iOS 4.0 string is:
Mozilla/5.0 (iPhone; U; CPU OS 3_2
like Mac OS X; en-us)
AppleWebKit/531.21.10 (KHTML, like
Gecko) Version/4.0.4 Mobile/7B334b
Safari/531.21.10
Note the strings "iPhone" and "CPU OS 3_2 like Mac OS X" which tell you it's an iPhone running iOS 3.2.
You are probably really looking for the user agent string of the browser people use on the iPhone (not the phone itself), which is normally Mobile Safari, in combination with the device (iPhone, iPad, etc.) Remember that a user could install other browsers if they wish, and that iOS runs on more devices than just the iPhone (two others, at the moment, and who knows what will happen in the future.) This is a long way of saying, be careful how you do and what you do with your user agent sniffing.

user agent in safari to iphone

I've changed the User Agent in Safari browser to iPhone but nothing happens. Am I misunderstanding the use of this? I'm running Safari in a window environment.
Thanks,
rod.
'nothing happens' means what? What are you expecting? After changing user agent I need to force refresh the webpage, and go to mobile version of website again.
E.g. when with firefox's user-agent, http://m.google.com redirects to another page. But with iPhone's it shows original mobile website. The user agent for iPhone 3 is as follows:
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16

Distinguish between iPhone web browser and iPhone app user agent

What is the best way to distinguish on a server between a request that came from an iPhone through the web browser vs through an iphone with an app written in objective c? What differences do I look for in the user agent string?
It seems that iPhone Apps using the UIWebKit HTTP request component have user agent string like the following
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; fr-fr) AppleWebKit/532.9 (KHTML, like Gecko) Mobile/8A306
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; fr-fr) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7D11
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; fr-fr) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7E18
While Safari on iPhone has mostly the same string but ending with " Safari/XXX"
However, it is also possible to change the user agent of UIWebKit then there is no guarantee that you'll grab every iPhone app by proceeding this way.
I believe user agents from the Safari app start with "Mozilla", while user agents from apps start with the name of the app.
Indeed the user agent will be different.
in PHP, you can find out with this: $_SERVER['HTTP_USER_AGENT']