I created a very simple mobile version for my website. I switch to it by detecting the visitor's viewing width of their screen. If it's less than 400 pixels wide, it switches the visitor to the mobile version.
Here's the question...
I want to give the visitor the option of swtiching back to the normal website. However, I can't just put a link to the normal website because it would detect their viewing width and send them right back to the mobile version.
What's the best method to allow them to switch back and forth between the mobile version of the website and the normal version of the website?
Based on what I've read, I should install a cookie that toggles each time the visitor changes their preference between the mobile version and the normal version of the website.
The problem is I have no experience creating a cookie and it's a little more complex than I anticipated. With that said, here's specifically what I want to do...
By default, I want the value of mobileSwitch to be 'off'.
I want to include a button on the page that will turn the value of mobileSwitch to 'on' and then take the visitor to the mobile version of my website.
I would not be so sure. A session variable is active only as long as the user remains within the same domain. If the user closes his browser or he quits the domain, the session is gone, so that no information are stored. Except, maybe, if you use a login user/password and a database, but this is another discussion.