Two Scripts to Detect Mobile Browsers

When writing mLearning content, sometimes it is good to have a single URL that all your participants can access. The following are two scripts that you can add into the head content of your page that will detect a mobile browser and automatically redirect your users to a 'mobile friendly' version of your site.

_____________________________________________

Script #1

In this script, change the $location attribute to the page you want your users to see if they are using one of the mobile devices listed in the if(stristr.. string.
____________________________________________________


Script #2


This is a simpler script to detect Windows CE browsers (although you can detect any browser with this script.) Simply change the window.location URL to your mobile friendly site.


____________________________________________________




In both of these cases, I'm redirecting the site to the mobile version of this site- http://www.2mlearn.mobi/


I will be adding this script to http://www.mlearning-world.com/ in the next few days
to help all our visitors with mobile devices.



Share this

Related Posts

Previous
Next Post »