开发者

kohana 2 hooks mobile redirect

开发者 https://www.devze.com 2023-01-15 06:54 出处:网络
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 vie

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开发者_StackOverflow中文版 be accomplished..


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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消