0

i'm working on an html page that check if the traffic is mobile or desktop. After that, if mobile it redirect to a "page A", else if a desktop it redirect to a "page B".

For now i have this code, but not working on mobile, the redirect works only from desktop traffic.

How can i fix it?

<html>
<head>
<script>if (typeof window.orientation == 'undefined' || len(navigator.plugins.length) > 0){
            document.location.href='http://pageA';
            }
    else {
            document.location.href='http://pageB';
            }</script>

<title>My test</title>


</head>

<body>

</body>
</html>
Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167
supap
  • 89
  • 9

1 Answers1

0

I've used this implementation with .htaccess and/or javascript

It'll require some modification for your desired result but both solutions provide a sound method of detection and redirection -

http://www.inmotionhosting.com/support/website/redirects/mobile-redirect

jshbrmn
  • 1,737
  • 3
  • 22
  • 52