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.
- Mobile support must be enabled
- A mobile version of the template for that page must be in place
The Tags
Tag | Description |
---|---|
{ap_mobile:desktopLink} |
Provides the link to switch to the desktop version of a page <a href="{ap_mobile:desktopLink}">Desktop version</a> |
{ap_mobile:mobileLink} |
Provides the link to switch to the mobile version of a page <a href="{ap_mobile:mobileLink}">Mobile version</a> |