Hi, Dan... and thanks for the feedback...

What I would like to do is allow ColdFusion server-side
validation messages to be delivered back to the form page
via Ajax if JS is available and, if not, just refresh the page.

Isn't that what you do with this code is your
ex2.3_mailing_list_validation.cfm example for the
ex2_process.cfm page?

Rick

Your code:

<!---// if this is an AJAX call, we must return JSON data //--->
<cfif structKeyExists(url, "ajax") and url.ajax>
        <!---// clear all generated data //--->
        <cfcontent type="text/xml" reset="true" />
        <cfoutput>{
                success: #stAction.success#,
                message: "#jsStringFormat(stAction.message)# [AJAX]"
        }</cfoutput>
        <cfexit method="exitTemplate" />
<cfelse>
        <!---// reload mailing list page, which will show any errors //--->
        <cfinclude template="#form.formUrl#" />
        <cfexit method="exitTemplate" />
</cfif>





-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Dan G. Switzer, II
Sent: Friday, April 20, 2007 9:16 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Best way to determine if a user has Javascript
enabled?


Rick,

>Good morning, all...
>
>Is there a fool-proof way to determine if a user has Javascript
>enabled in their browser?

As discussed on another mailing list, there's no real need to detect if JS
is enabled. If you write unobtrusive JavaScript (which is what jQuery helps
you to do) if the user has JS disabled, things will continue to work.

There's no reason to have separate JS/non-JS pages in most cases--especially
for the kind of things you're working on.

That said, the most full proof way I'm aware of to test if JS is
enabled/disabled is driving traffic through a splash page which does a
redirect.

<meta http-equiv="refresh" content="2;url=page.htm?js=false">

<script type="text/javascript">
self.location = "page.htm?js=true";
</script>

In this example if JS is enabled, the JS code would be executed redirecting
the user to page w/a URL parameter indicating that JS was enabled. If the JS
code doesn't execute, then the meta refresh would take over.

However, I can't emphasis this enough, testing for JS is really unnecessary
for all the work you've been talking about. You keep saying you want to make
your code easier to manage and develop and detecting for JS in this case is
just adding more complexity. 

It's much easier to just write the JS and if it doesn't execute then let the
server-side code re-enforce the behavior.

The last time I wrote any kind of detection script, was for a project that
required Flash. It's been 9 years since I've written a script to detect for
JS--and that was because I didn't know better.

-Dan



Reply via email to