Well said, Dan.
On 4/20/07, Dan G. Switzer, II <[EMAIL PROTECTED]> wrote:
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