Can Seaside detect if a browser has Javascript support disabled?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can Seaside detect if a browser has Javascript support disabled?

Rick Flower
I was reading a few news items on the smalltalk newsgroup
(comp.lang.smalltalk) and there is a thread about Squeak/Ajax and it got
me wondering if someone tried using my Ajax enabled Seaside app with a
JS-less browser, is Seaside would be capable of detecting that condition
and notifying them that JS needs to be enabled for the site to function
properly?  I'm sure I'll get comments suggesting that I make sure the
site degrades gracefully if JS is disabled (which I already know!) -- I
just want to know if Seaside can detect that condition or not...

MTIA!
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Can Seaside detect if a browser has Javascript support disabled?

Lukas Renggli
> I was reading a few news items on the smalltalk newsgroup
> (comp.lang.smalltalk) and there is a thread about Squeak/Ajax and it got
> me wondering if someone tried using my Ajax enabled Seaside app with a
> JS-less browser, is Seaside would be capable of detecting that condition
> and notifying them that JS needs to be enabled for the site to function
> properly?  I'm sure I'll get comments suggesting that I make sure the
> site degrades gracefully if JS is disabled (which I already know!) -- I
> just want to know if Seaside can detect that condition or not...

This has not much to do with Seaside. With Seaside you can access all
the information available trough request headers, etc.

To detect if JavaScript is enabled you need a trick (ask Google, I am
sure there are a lot of possible solutions). Something like
redirecting to a different page using JavaScript could help you gather
this information.

What I rather suggest is to write code that gracefully degrades if no
JavaScript is available. It is very strait forward to do this with
Scriptaculous:

html span
        id: 'counter';
        with: count.
html space.
html anchor
        onClick: (html updater
                id: 'counter;
                callback: [ :render | self decrease. r render: count ];
                return: false);
        callback: [ self decrease ];
        with: '--'.
html space.
html anchor
        onClick: (html updater
                id: 'counter;
                callback: [ :r | self increase. r render: count ];
                return: false);
        callback: [ self increase ];
        with: '++'

Note: the 'return: false' is important to make sure that the event
handling is stopped to avoid a full page reload.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside