Mobile device detection script


I have built a mobile version of my website and am using code found here [url=“”][/url]

I tried adding the code to my .htaccess file which works but only for the home page. I tried the php version of the code but this produced session errors i.e. headers already sent.

Where can I put the code so that it will work on any page but not cause any errors.

The main shop is an old 1.3.5 version.



Okay so I downloaded the javascript version of the detection code and pasted this into a file called mobdetect.js which after changing the url at the bottom of the javascript so that it points to my website I uploaded to my websites root folder.

I then edited /skins/your_active_skin_name_here/customer/index.tpl by pasting the code below just before the closing head tag

Now every page on the front end of my store checks to see whether the visitor is using a mobile device and if true redirects to my mobile store.