Switching Between Mobile and Desktop Versions of a Page

Overview

Through the use of a couple of special tags you can easily provide links that allow your visitors to switch between the mobile and desktop versions of page. This is especially useful for newer mobile devices that can handle the desktop version of a page. Visitors using those devices might prefer to browse the full version of the site instead of the typically stripped down mobile version.

Once the link has been clicked the visitors session will be updated to remember which version they prefer. They will then be redirected with a 301 response code to the page that they were just viewing. The only difference is that they will now be viewing the page under the mobile version or the desktop version, whichever one they picked. 

In order for this to work a few things must be in place.

  1. Mobile support must be enabled
  2. A mobile version of the template for that page must be in place
Optionally, in order to support all devices (even desktop browsers) the catch-all mobile profile must be setup. If it's not then only allowed mobile profiles will be able to view the mobile version.

The Tags

TagDescription
{ap_mobile:desktopLink}

Provides the link to switch to the desktop version of a page

Example:

<a href="{ap_mobile:desktopLink}">Desktop version</a>

{ap_mobile:mobileLink}

Provides the link to switch to the mobile version of a page

Example:

<a href="{ap_mobile:mobileLink}">Mobile version</a>