Jump to content

force enable javascript


phppaper

Recommended Posts

In The head section add something like this

<noscript><meta http-equiv="refresh" content="0;url=http://yourdomain.com/JS_IS_A_MUST.html"></noscript>

This will redirect to JS_IS_A_MUST.html where you can explain why JS must be enabled.

 

Be carefull with this implementation, Seach engines will NOT be able to spider your pages that contain this tag.

I'm of the group that believes firmly that javascript should NEVER be required (with maybe the exception of a chat program). I use javascript extensively in my sites, but I always add it as an extra feature, not a required feature. For example, when creating forms, I will build the whole form and all its validation in PHP, then I will put javascript over top to check the form, and execute the javascript if the user has javascript enabled, with the PHP working as a backup for when javascript is disabled. Another example would be an AJAX slideshow I developed. It has a 'back' and 'next' button under the image being viewed. If javascript is enabled, then the image in the viewer switches to the next image. If javascript is disabled, then the page reloads with the next image in the viewer.

 

When I find a site that explicitly requires javascript, I just shake my head and say 'sloppy programming'. If its not direly necessary for me to use that site, then I don't use it.

I'm of the group that believes firmly that javascript should NEVER be required (with maybe the exception of a chat program). I use javascript extensively in my sites, but I always add it as an extra feature, not a required feature. For example, when creating forms, I will build the whole form and all its validation in PHP, then I will put javascript over top to check the form, and execute the javascript if the user has javascript enabled, with the PHP working as a backup for when javascript is disabled. Another example would be an AJAX slideshow I developed. It has a 'back' and 'next' button under the image being viewed. If javascript is enabled, then the image in the viewer switches to the next image. If javascript is disabled, then the page reloads with the next image in the viewer.

 

When I find a site that explicitly requires javascript, I just shake my head and say 'sloppy programming'. If its not direly necessary for me to use that site, then I don't use it.

 

No, I don't think JS is sloppy coding.

 

How do you do AJAX with HTML? There are tons of things that just need JS. Sure, some things can be done with just HTML, but there are tons of applications where JS is needed.

 

Chris

I'm with haku.

 

You can develop everything to work without Javascript first and then add it in later.  Then you get the best of both worlds.

 

To take it a step further, Javascript should not be embedded in your markup either.  This gets you a slap on the wrist in my book:

<a href="#" onclick="alert('hi');">click</a>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.