Harsh Gupta
Harsh Gupta

Reputation: 173

Dissallowing Javascript-disabled users to browse a web application

I have a JS/jQuery intensive website and certain very important functionality works on JS and Jquery (features without which the site wont function properly). I want to disallow users who have JS-disabled to use my web app. Has anyone done this before?

Upvotes: 2

Views: 35

Answers (2)

David
David

Reputation: 219057

You can use the noscript tag to easily display a message to users with JavaScript disabled. Something like this:

<noscript>
    You must have JavaScript enabled in your web browser to use this site.
</noscript>

You can't, however, disable the site for those users. This is because you have no way of detecting whether or not JavaScript is enabled until you've already sent the page to the client.

Note also that this is not a recommended practice in general. It's better to provide the basic functionality of the site and then use JavaScript to enhance the UX, not to require JavaScript entirely.

Upvotes: 1

jotadepicas
jotadepicas

Reputation: 2493

The noscript tag allows you to provide alternate content to users with javascript disabled. See http://www.w3schools.com/tags/tag_noscript.asp

Upvotes: 0

Related Questions