0

I have my main site redirect to a mobile version if your view it from you mobile device, i wanted to use media queries but that was not an option for this site. On the mobile version i wanted to implement a "View Desktop Version".
However i am unsure of the correct/best way to do this. I am using the Dectect mobile browser plugin from
http://detectmobilebrowsers.com.
If the plugin returns true - meaning you are viewing from a mobile browser - then the main site redirects you. How can i add a "View Desktop Version" button and bypass the detection plugin?

Thanks guys

Jasper
  • 75,717
  • 14
  • 151
  • 146
Kenneth Ashley
  • 303
  • 1
  • 5
  • 13

1 Answers1

1

You could use jQuery to set a cookie to remember the current state.

In your main site, your code can be updated to something like this (pseudocode):

show_desktop_site = $.cookie('show_desktop_site') AND NOT IsMobileBrowser;

IsMobileBrowser would be the response from the detectmobilebrowsers.com script.

$.cookie('show_desktop_site') is a jQuery Cookie set in the mobile site when a user elected to go and view the desktop site. See e.g. http://archive.plugins.jquery.com/project/Cookie - many options are out there.

You can redirect the user based on show_desktop_site.

Ryan
  • 26,884
  • 9
  • 56
  • 83