开发者

kohana 2 hooks mobile redirect

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜