I have device detection in place using the following code:
<script>
if( /Android|webOS|iPhone|iPod|BlackBerry|IEMobile/i.test(navigator.userAgent) ) {
if(window.location.hash == "#desktop"){
// Stay on desktop website
} else {
window.location = "<?php bloginfo('url'); ?>/m";
}
}
</script>
This works in that it gets the user back to the desktop version of the website, however, my problem occurs when a user taps a link on the desktop site and then gets redirected to the mobile site.
How can I always append the #desktop
to all links if the View desktop link has been clicked? Is this possible?