Ruskie
Ruskie

Reputation: 253

Redirect If On Iphone/Ipod What about Ipad/Ipad Mini

My question today is how may I redirect a Ipad user to a different website. For Iphone/Ipod It was simple:

    <script language=javascript>
    <!--
        if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
        location.replace("#");
        }
    -->
</script>

What I want to do be able to do the same but on Ipad/Ipad Mini. Is it possible?

Upvotes: 0

Views: 117

Answers (1)

zk_mars
zk_mars

Reputation: 1339

I don't know about iPad mini but for iPad you can use this

navigator.userAgent.match(/iPad/i)

you can also write a rule in .htaccess:

RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$
RewriteRule ^(.*)$ http://domain.com [R=301]

Upvotes: 1

Related Questions