Eli
Eli

Reputation: 14827

Is there a way to detect if user using iphone 3GS or 4 to browse the website?

I want to detect if user using iphone type lower than iphone 4 in order to run different kind

of HTML5 video because iphone 3 can only run low quality video. Can someone give me some

solution to achieve this goal. Thank you very much in advance!

Upvotes: 0

Views: 1238

Answers (2)

Clark T.
Clark T.

Reputation: 1470

I've used this on several high traffic sites its light and does a fantastic job

http://code.google.com/p/php-mobile-detect/

Upvotes: 1

Dador
Dador

Reputation: 5425

On server (php):

<?php
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Apple-iPhone3C')!==false || strpos($_SERVER['HTTP_USER_AGENT'], 'Apple-iPhone4C')!==false) {
    echo 'iPhone 4';
} else {
    echo 'other model';
}

See also: detect in browser.

Upvotes: 0

Related Questions