[Catalyst] Checking client browsers, best approach?

Yuval Kogman nothingmuch at woobling.org
Wed Sep 20 15:12:41 CEST 2006

On Wed, Sep 20, 2006 at 07:44:54 -0500, Ryan wrote:
> OK, here is what I need to do.  I'm writing a reservation system for a
> hotel and I have some cool features in mind for the process but they
> require javascript and "newer" browsers. What I was planning on doing is
> creating the bare-bones pages that work in any browser, no JS just all
> server calls etc...then I want to go back and insert the new stuff where
> it's appropriate but only for the people that can handle it.  I was
> thinking of having a landing page(default or something) that ran some
> tests to see if that could fail. Then I thought it might be easier in the
> begin function to just check browsers and set a variable in the stash if
> they can handle the new stuff or not. What's the best way to go about
> doing this, should I just scan the req variables that come in and make my
> decision on that or does Catalyst have something better?

You can use Catalyst::Plugin::Browser.

However, a better approach for fallback is to use the various
javascript event handlers, and return false.

For example, say you have a form, and it works normally with plain
HTML, but you want to use an ajaxified version that does something
else, you can add an onSubmit event handler, do the form handling in
JS, and simply 'return false' when you're done to cause the browser
to abort the normal submission.

  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060920/04869723/attachment.pgp 

More information about the Catalyst mailing list