Smartphone Detection for Mobile OSCommerce

Directing visitors who are using Smartphones such as IPhones or Androids to view mobile-enabled OSCommerce sites is easy. Simply go to or other similar sites and get a API script reference. Paste this script in the head of your normal sites index. Voila, anyone using a smart phone will be directed to your mobile OSCommerce site.

For a DEMO:, go to on your laptop or desktop computer. You’ll see the regular OSCommerce shopping cart. Now go to the same site, but using your smartphone. You’ll be at Niora’s mobile OSCommerce site.

Because the script is maintained externally, the script is always up-to-date (in theory), and covers all popular smart phones. If you would like to use your own code loaded locally on your website, you’ll need code for all the different phone types. is an example of a site that goes into detail on how to do this.

In the meantime, here is a javascript-free php snippet you can post at the top of includes/application_top.php of your normal site that will redirect all IPhone and IPad users to your mobile site.

$handsetdetection= '<script type="text/javascript" src=" '.(isset($_SERVER&#91;'HTTPS'&#93;) && (strtolower($_SERVER&#91;'HTTPS'&#93;) == 'on') ? 'https://' : 'http://') . '"></script>';
echo $handsetdetection;

(snippet courtesy of catswhocode)