Redirect to Mobile site & switch back to Desktop Site

I have a desktop and mobile site on two different domains www.domainname.com and m.domainname.com. I want to set up an automatic redirect from www.domainname.comm.domainname.com when it’s visited on a mobile device, but also give the visitor an option to switch between desktop and mobile versions for mobile users. I searched multiple forums but they only talk about toggling the page.

Can anyone lay out the steps to do something like this? Below is what I currently use inside the desktop site , but this only redirects one way, and keeps redirecting to the mobile site if users tries to access the desktop site on their mobile device.

<script type="text/javascript">
 <!--
 if (screen.width <= 800) {
 document.location = "m.domainname.com";
 }
 //-->
 </script>

I’d do PHP or something like that and set a session variable to be set to TRUE if the user wants desktop only. The initial set could be done in various ways up to your discretion.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.