about mobile and desktop site redirection

Avatar
  • Answered
i have a mobile and desktop and i add a mobile redirect script in desktop site and it work fine but i also add a link "show desktop sitte" in mobile site but due to mobile redirect script my cousmer is unable to view desktop site when they click on "show desktop view" they again redirect to mobile site
please help me
thanks
Avatar
JeffMa
Hello, The following javascript will allow you to easily redirect mobile users, but allow specifically defined users to view the full site:

<script type="text/javascript"> var getStr = window.location.search.substr(1); var getArray = getStr.split ("&";; var get = {}; for ( var i = 0; i < getArray.length; i++) { var tmpArray = getArray[i].split("="); get[tmpArray[0]] = tmpArray[1]; } if (get.m == "no") { window.location = "http://wwww.fullsite.com"; } else if (screen.width <= 800) { window.location = "http://www.mobilesite.com"; } </script>

Placing this within your code will allow you to link to a URL such as example.com?m=no that will disable the mobile redirect. Note: You will need to remove any other mobile redirects that you have in place. In addition, I highly recommend that you use responsive design elements within your site rather than a different mobile site. The impact on user experience as well as SEO is significant.