Thanks for the replies.

So, I take it there is no ~simple~ way to detect javascript-ness, like
looking at user_agent.  Anything involves some trick or another, and
requires some interaction with attempted js that "fails".

I was kinda hoping that Prototype or Script.aculo.us had a function
built-in that gave you the answer.  I just want to set a session
variable so I know not even to bother with js interactions.

I realize the holy grail is gracefully degrading (or incrementally
enhanced) interaction, but my reading (and experimenting) so far
indicates that is not always easy. Besides, I'm just getting started
with js on rails, and wanted to experiment a bit.

--David.

On Jun 29, 7:40 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
> David,
>
> Ummm....if it doesn't support JavaScript, what kind of "variable" are
> you talking about?  Server-side?  'Cause if there is no client-side
> JavaScript, there are no client-side JavaScript variables.  Or perhaps
> you mean a cookie?
>
> You can definitely test whether JavaScript is enabled:  Have the page
> assume that it isn't, and then use JavaScript to change that
> assumption if it is.  The two main variations on this theme, off the
> top of my head, are:
>
> 1. Have a page that's fully-functional without JavaScript, but gets
> "spruced up" by JavaScript if it's enabled.  No "detection" per se is
> required, it's just that the sprucing up won't happen if the client
> doesn't have JavaScript.
>
> 2. Have a small intro page that redirects to a version of your page
> that doesn't use JavaScript if JavaScript isn't enabled, or to a
> version that does if it is.  You can easily do that by having
> JavaScript trigger a page load (by setting location.href) immediately,
> and having a meta refresh fallback that happens after a pause (e.g.,
> if the JavaScript thing hasn't happened).
>
> In either case, if you like you can set a cookie to remember whether
> JavaScript is loaded for subsequent page loads (have the page set the
> cookie to "not enabled", and set it to "enabled" via JavaScript in the
> page), although if the browser supports JavaScript the user can change
> whether it's enabled between page loads, so your cookie can get out of
> date.  Users don't typically do that, of course.
>
> Hope this helps,
> --
> T.J. Crowder
> tj / crowder software / com
>
> On Jun 29, 4:45 am,djlewis<[EMAIL PROTECTED]> wrote:
>
> > Is there a simple way to tell if the browser you are talking to
> > supports javascript and has it turned on? I'd like to set a variable
> > to that effect.
>
> > Thanks. --David.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to