Scripts to identify mobile browsers and redirect user to mobile website

Hello,

We are currently looking for a script that we can drop into our site that identifies if a mobile device is viewing a webpage and redirects them to the mobile version of the site.

Thanks.
PlumInternetAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IPHONE REDIRECT PAGE</title>

<script language="javascript">
	var is_mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
	if(is_mobile) window.location = 'http://www.mobile-version.com';
</script>

</head>

<body>

<p>see this - redirect did not work</p>

</body>

</html>

Open in new window

0
 
leakim971PluritechnicianCommented:
Thanks for the points!
0
All Courses

From novice to tech pro — start learning today.