Force Exit of Mobile Site

christopherl

New Member
Hi Everyone,

This is my very first post to this forum and I am quite new to web-design. I created a mobile site for my company and used php to detect the device and re-direct to the mobile site. I know not everyone on a mobile device would prefer the mobile sites so I put a link in the footer of the mobile site to the index page of the non-mobile site. The problem is they just get redirected back to the mobile site because it detects the device again.

I looked at some other mobile-sites and they use force exit to get out of the mobile site if on a mobile device. How do I do this?

Thanks!
 

smoovo

New Member
Sessions, that's your answer. We are using sessions to bypass some automatic functions.

Your PHP script detecting the mobile browser, even if you are clicking on a different link, it will go to it, but will detect again the browser and jump back.

Session will solve the problem. When the visitor will click on the link to the regular page it will store a session variable. Each page of your site that contains the detection function will get "&&" statement, like this.

PHP:
if (isset($_SESSION['regular']) && "your detection statement") {...

This will tell the page not to act as a mobile browser.

Remember, each page should contain "session_start()" at the very top of the page.


- Enjoy. :)
 
Top