Redirect 2 Mobile Website: Working on Willow4U.com

Redirect 2 Mobile Website: Working on Willow4U.com

How to Detect iPad and Redirect to iPad Version Website
by scottrockers.com

With all the buzz about the iPad, I wanted to post another useful snippet of code. It detects whether the person viewing your website is on a iPad. If they are on a iPad, you can redirect them to a iPad version website or just to another page, its up to you. If they are on a normal computer it doesn’t redirect them and they go on as normal. Its just some simple javascript, and if you want to use it just change the “document.location” value to the url you want them redirected. Here is the code, and its just the same as when you detect for the iPhone with an extra argument.

<script type=”text/javascript”> // <![CDATA[
if ((navigator.userAgent.indexOf(‘iPhone’) != -1) || (navigator.userAgent.indexOf(‘iPod’) != -1) || (navigator.userAgent.indexOf(‘iPad’) != -1)) {
document.location = “http://www.scottrockers.com/iphone.html&#8221;;
} // ]]>
</script>
Advertisements

2 thoughts on “Redirect 2 Mobile Website: Working on Willow4U.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s