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>