Symfony: Special routing for mobile browsers
Is there any way that I can detect browser type on routing and use specific controller? I want to be able to do something like this in routing.yml:
mobile:
url: /*
requirements:
brows开发者_如何学Goer: mobile
This symfony blog article from Fabien describes an elegant solution for an iPhone-optimised version of your website. Change the regexp he uses to something that more broadly matches the browsers/clients used to access your site, and you have a 'mobile' version.
EDIT: I would add that perhaps a different 'app' altogether might be a better solution, a la Facebook's m.facebook.com interface.
Not really quite what you are after, but you could use the scripts from http://detectmobilebrowsers.mobi/ to detect what type of browser a request is coming from. You might they be able to integrate these scripts into a base controller (or router) class to handle requests appropriately.
精彩评论