views:

23

answers:

1

I placed a mobile hook in the hook directory to look for mobile devices and redirect to the appropriate controller. My question is if I want to put a link on the mobile pages to have the option to view the full site. How would by pass the hook. What is the correct way for this to be accomplished..

+1  A: 

Couple of options:

1) When you redirect to the mobile site add a url parameter that the mobile controller will check for and add the appropriate link back to the full site. Eg redirect to http://m.yoursite.ext/?fromFullSite

2) The mobile controller can look for the referer in the $_SERVER headers and see if the user came in from the full site, eg

if (strpos($_SERVER['HTTP_REFERER'], 'http://yoursite.ext/') === 0) { 
    //was redirected, add link
}
Fanis