First off I know that a responsive site is no. 1 but at the time being that unfortunately is not an option! I also have very javascript coding skills.
I need to detect whether the user is using a desktop, a tablet or a mobile and redirect them.
User uses a desktop - stay on site (A). User uses a tablet - redirect from A to site B. User uses a mobile - redirect from A to site C.
If I screen width and dpi is there not a possibility that some mobiles and tablets gets caught anyway and redirect to desktop version?
I have this at the moment.
<script>
if (navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
) {
document.location = "B";
} else if (navigator.userAgent.match(/iPad/i)
) {
document.location = "C";
} else {
document.location = "A";
}
</script>
Thank you in advance for your help!