Code to detect Mobiles and To redirect Javascript

By kedinn 2013/10/22

Web-reasons

At present the use of the movable devices is enough and continues increasing since our websites you have visits by mobiles and is the reason to want to improve our website, I was looking for information and to look for the form that allowed me to redirect my Web to another compatible site for mobiles example:

www.nombreweb.com
it redirects to us when we opened with movable devices a
www.movil.nombreweb.com or www.miwebmovil.com
I share the code that this in Javascript:

bar device = navigator.userAgent if (device.match (/Iphone/i)|| device.match (/Ipod/i)|| device.match (/Android/i)|| device.match (/J2ME/i)|| device.match (/BlackBerry/i)|| device.match (/iPhone|iPad|iPod/i)|| device.match (/Opera Mini/i)|| device.match (/IEMobile/i)|| device.match (/Mobile/i)|| device.match (/Windows Phone/i)|| device.match (/windows mobile/i)|| device.match (/windows ce/i)|| device.match (/webOS/i)|| device.match (/palm/i)|| device.match (/bada/i)|| device.match (/series60/i)|| device.match (/nokia/i)|| device.match (/symbian/i)|| device.match (/HTC/i)) \ {window.location = “http://www.miwebmovil.com/?; } else \ {}

And if they do not want that one redirects a movable type simply they clear it
Example I do not want to redirect for exempt Ipad then a part of the code, this is the present one

| device.match (/iPhone|iPad|iPod/i)|

and we cleared |iPad thus we would have left

| device.match (/iPhone|iPod/i)|

the same way for other devices.

I hope that it serves do not stop to them following to us:)