Webmaster Hack – How to Detect Palm Pre!
For webmasters and web designers who are tailoring their website to Palm Pres and other smartphones, here’s some free PHP code that will detect Palm Pre and other smartphones from my DIY tech blogwe:
<?php
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],”iPhone”);
$android = strpos($_SERVER['HTTP_USER_AGENT'],”Android”);
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],”webOS”);
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],”iPod”);
if(!$iphone && !$android && !$palmpre && !$ipod) {
?>
Your code goes here that you want only executed when it’s not a smartphone.<?php } ?>
This could be great if you want to load a different version of your website or even just to test your website on the Palm Pre. That way, your regular readers from desktop computers and laptops won’t get affected while you test your version of website for the Palm Pre.
Free Nexus One phones
Enter your zip code here and find out if you can qualify for 2 free Nexus One phones.









April 6th, 2010 at 7:08 am
Evaluate & Preserve your iPad for Free of cost! -> http://bit.ly/cFBuis
May 10th, 2010 at 2:48 am
Thanks for sharing the code
October 25th, 2010 at 10:21 pm
This didn’t work until I changed the double quotes to single quotes. Then it worked like a charm.