It’s good practice to give your website users the ability to choose between using the mobile version and the desktop version. In this tut we use PHP and jQuerymobile to accomplish this task. We will create a session and store the preference and use PHP to detect mobile browsers by their user agent.

Download source .zip

4 responses to “Creating a "show desktop website" button for your mobile site”

  1. Ghansham says:

    hi anthony, u doing a great job, hope to see more interesting jqmobile tutorials.

  2. Kate says:

    Hi Anthony,

    I’ve got a question in regards to this, is there an email I can contact you on. Kind regards,


  3. Greg says:

    I would like to use this exactly as you have it with one modification: When a mobile device is first detected, I would like to ask them if they want the mobile version or the site or the desktop version.

    This would seem easy but I cant seem to get my head around it.


  4. Shahab says:

    hi, for some reason i get a loop when trying to switch from mobile to desktop. I’m using the same code. any idea why this would happen?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get actionable training and tech advice

We'll email you our latest articles up to once per week.