2

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?

1
  • Just put some javascript on your site that redirects a user to your real site. Commented Jun 28, 2015 at 12:51

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Some things can't be accomplished using basic HTML and CSS. Complex web application require extensive use of Javascript, not just for UI/UX. Take Google Maps for instance, would it work without JS. What if an application uses the Google Maps API as a core functionality?
@HarshGupta: Fair point. I just tested Google Maps without JS and I'm actually kind of disappointed that all I saw was a blank page. I would have thought they'd have some kind of basic interface or at least a helpful message :)
0

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

5 Comments

I do know about the noscript tag. My question was whether its possible to somehow disable the website for JS-disabled users.
What do you mean by "disable" then?
@harsh Gupta, a few options, none of which are perfect: use noscript, put static content in a doc and use js to replace it with your real content, detect js and use it to redirect the user to your real site. If that's not what your looking for then I agree, what do you mean "disable"?
By disable I meant 'any arrangement by which they can't browse the website without enabling JS"
The noscript tag accomplishes this. However if you want to force a 404 or something like that, I think it would be extremely complicated and not worth the effort.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.