streetparade
streetparade

Reputation: 32918

What do you do if your site visitors have JavaScript disabled?

What would you do if your site visitors disabled JavaScript? Do you block them?

Upvotes: 5

Views: 1232

Answers (9)

Dead account
Dead account

Reputation: 19960

Use the NoScript tag to say "Hey, Enable Javascript fool!"

<script type="text/javascript">
       alert("Hello World!");
</script>
<noscript> 
       Hey, Enable Javascript fool!
</noscript>

(Please note that this is code is not ready deployment to your website. You can change the message to something more suitable than plain text.)

Upvotes: 3

Trevor
Trevor

Reputation: 6689

If your visitors didn't know they have JavaScript disabled, a simple message would let them know they should enable it.

<noscript>Please enable JavaScript in your browser</noscript>

Upvotes: 0

mthurlin
mthurlin

Reputation: 27315

For every site I build, I compare the cost of development for degrading gracefully, versus the loss of income by scaring off ~2-3% of the audience. Not caring about non-javascripters/Opera/etc usually wins...

Upvotes: 1

raveren
raveren

Reputation: 18539

To couple with <noscript> I have all elements that require JS to function with class="js-required".

Then CSS: .js-required{display:none;}

JS on page load: $('.js-required').css('display','block')

Upvotes: 2

easement
easement

Reputation: 6139

Ideally, you would use progressive enhancement which entails guaranteeing a base user experience and then adding all the flourishes for browsers that can handle them.

Upvotes: 15

infinitloop
infinitloop

Reputation: 3011

you can check this out:

How to detect if JavaScript is disabled?

Upvotes: 0

Decent Dabbler
Decent Dabbler

Reputation: 22783

Indeed degrade gracefully. If that's not an option (anymore ;-)) then at least notify them with utilizing a <noscript> tag.

Upvotes: 10

Anthony Forloney
Anthony Forloney

Reputation: 91816

Your website should be somewhat prepared if JavaScript is disabled, either display a message that your website works better with JavaScript enabled or work-around it.

Upvotes: 1

SilentGhost
SilentGhost

Reputation: 319939

you would degrade gracefully.

Upvotes: 14

Related Questions