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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

You didn't properly read what I said. I didn't say AJAX is sloppy programming (I use it extensively). I said AJAX without an HTML backup for people who have javascript turned off is sloppy programming. There is a big difference.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.