How To Display A Message If Javascript Is Turned Off

Comments

Having an accessible website is very important it means that you are not neglecting any potential customers coming on to your site and being able to use it correctly.

But what do you do when the visitors comes on your website but hasn't got the browser functionality turned on to use your site.

Javascript is one of the main browser features you need to look for and be aware of what to do when this is turned off or turned on. Javascript allows you to do many things on your website from client-side form validation, slide shows, animations and changing HTML elements, there are loads of things you can do. But what if the visitor doesn't have Javascript enabled?

First you need to make sure that your site can work perfectly well without Javascript. Then you need to make sure that all validation is duplicated on both client and server side so you can catch things if Javascript is turned off. If you have something like a slide show which won't do anything if Javascript is turned off you might want to display a message to non-javascript users to say why is isn't working correctly.

The snippet below will display HTML in the browser if Javascript is turned off.

<noscript>
The slideshow is not working correctly because Javascript is turned off.
</noscript>

Advertise here

Comment