如何在网站的桌面版和移动版之间切换?

I'm currently using the following method to switch between mobile and desktop versions of a WordPress site with WordPress Mobile Pack

<a href="<?php echo site_url(); ?>/?wpmp_switcher=desktop" onclick="document.cookie='wpmp_switcher=desktop;path=/;';">Switch to desktop</a>

and

<a href="<?php echo site_url(); ?>/?wpmp_switcher=mobile" onclick="document.cookie='wpmp_switcher=mobile;path=/;';">Switch to mobile</a>

I uses a session cookie to determine which theme to be displayed.

However this method is unable to handle the following scenarios

Scenario 1:

  1. User is using mobile web version
  2. User clicks "switch to desktop" link
  3. User is redirected to desktop version.
  4. User types site name (example.com) on the browser

Scenario 2:

  1. User is using mobile web version
  2. User clicks "switch to desktop" link
  3. User is redirected to desktop version.
  4. User presses device/browser back button

In both scenarios I need to redirect the user to mobile version of site.