[Catalyst] Browser Detection?
John M. Dlugosz
wxju46gefd at snkmail.com
Sun Mar 6 14:45:05 GMT 2011
On 3/6/2011 8:06 AM, Charlie Garrison garrison-at-zeta.org.au |Catalyst/Allow to home|
wrote:
> Good morning,
>
> On 6/03/11 at 5:36 AM -0600, John M. Dlugosz <wxju46gefd at snkmail.com> wrote:
>
>> I'd like to set flags based on what that contains, like "send SVG images". Where would
>> I put that in MyApp so it gets called some time before rendering the view?
>
> I do browser detection (checking) in the `auto` method (so I can redirect to 'upgrade
> browser' page). But it could also be done in the `end` method if you just want to put
> stuff in stash for the view. If you've got a base method that all other actions chain
> from (which seems to be current best practices) then you could put it there too.
>
>
> Charlie
>
Ah, I see: the 'end' is the end of the controller phase and is still done before calling TT.
My general policy is not to forbid older browsers, but to withhold the CSS and add a
banner. So, I did that in the page-wrapping template for the site. I also plan to start
using SVG, so a flag that tells the TT template to give the IMG or the OBJECT, based on
whether the browser is on the list of those chosen to get SVG.
Looking toward the future, I'm hoping that IE9 will be a sea-change. So as with normal
programming languages, I'm thinking that a new project should use up-to-date features.
By chaining actions, you mean how http://site.com/foo/bar/baz will have a base action at
foo, then more action at bar, etc? I don't think my current project works well for that.
Is the current trend to chain back to the root? I don't see how that adds anything over
'auto', but I'll re-read that section carefully.
More information about the Catalyst
mailing list