Is there a way to detect if a user is using an iDevice WITHOUT reading the user-agent (which could easily be spoofed)? I want to have a mobile version (which will have no captcha), but desktop version will have captcha, so I want to use any other methods of checking other than UA-checks.
-
1With PHP there's no perfect solution. All the data passed via HTTP can be faked. – bwoebi May 02 '13 at 12:45
-
Hi, why you want to check?. Captcha is for checking if the user is a machine or a human. In iPhone there can only be a human starting the app. You know what i mean? :) – Retterdesdialogs May 02 '13 at 12:45
-
Okay, but faking UA is a child's play. Is there any advanced detection? – Vlad May 02 '13 at 12:46
-
@Retterdesdialogs He wants to protect his site against browser pretending to be a mobile device by spoofing the user-agent information! – Alexxus May 02 '13 at 12:54
-
@alexxus "Is there a way to detect if a user is using an iDevice". He wants to check if a user is using the iDevice. But you have not to check because who else could use the iDevice? :) I know what you mean, but because of the captcha thing i thougt he just want to check if it is a real user or a machine. – Retterdesdialogs May 02 '13 at 12:59
-
What are you trying to do here? Why are you using a captcha at all? Is this an interactive website or simply API calls from the application? – Marcus Adams May 02 '13 at 13:06
3 Answers
According to what I know, you can't detected mobile phones without user-agent. In fact, there is no any other function that check the mobile device..
You can check this lightweight class for detection of moblie devices:

- 715
- 1
- 7
- 23
First, as @bwoebi said, there is no other way to reliably check to see if they are on iOS.
However, you could say something like; OK, mobile devices have a screen size < Y * X, so I could just check the screen size. Unfortunately, this is also easily spoofed - by resizing the browser window.
In the end, it's probably not a good idea to skip Captcha for anyone. Just use it or don't - hackers are smart enough to set the user agent or resize thier browser. Also, it's not like people on Mobile can't solve Captchas.

- 25,519
- 37
- 106
- 129
-
-
@user2342080 No, but again, any HTTP headers are going to be easy to fake. You'll probably need to just make your mobile users solve Captcha just like everyone else. – Undo May 02 '13 at 12:59
I just used mobile detect about 30 min ago, it works PERFECTLY and easy to implement all you put in your code is:
// Check for a specific platform with the help of the magic methods:
if( $detect->isiOS() ){
// do code here
}
and it will do that code. easy to use.
Just put include 'includes/Mobile_Detect.php';
$detect = new Mobile_Detect();
at the top of your page and it works fine.

- 1,391
- 2
- 11
- 17