Question: We have a redirect script on our site that detects mobile devices and redirects users to a subdomain which goes to the mobile site folder. But now we need a mechanism that gives the visitor a button on the page that then reloads the page and bypasses this check. The goal is if a smartphone user wants to see the full site, we need to give them a button to push to do so. So, the question is: is it possible to disable this script when user clicks on that button?

Answer: 
I beleive cookies are a more better solution since they will not go away when the page is changed.

Just make a cookie when the user clicks the button and send him to the mainsite.

How to make the cookie:\_

```
setcookie("fullsite", "SomeRandomThing", time()+60*60*24*30); // It will expire after a month

```

If the cookie is not set, then make it redirect.

```
if (!isset($_COOKIE['fullsite'])
{
  // redirect
}

```

Similarily make a button for the user to switch back and make that button delete the cookie.
What I have done in the past is have a button on all the mobile specific pages that sets a cookie and then redirects the user back to the non mobile page, that cookie is read and if set adds a "back to mobile" banner and skips the mobile redirection code.

Also did a one time use version of this that does not show the "back to mobile" banner and automatically clears the cookie so the next page the suer visits they are back to mobile