I am creating a web app that uses Rails built-in helper functions to add ajax functionality to the site. I do not want the user to be able to use the app without JS as it will not function properly.
I need to be able to prevent this. How can I go about stopping the user from loading any of my pages without JS?
I have tried to use a tag in my layout. This detects the absence of JS but still renders the views. Putting the script tag around the yield prevents any view from being rendered.
Any ideas on how to do this?
You can have a
noscriptblock in theheadelement with a meta refresh tag in it. Example:you can read more about meta refresh here
Hope this helps
EDIT: To clarify, the
noscripttag runs only if JavaScript is turned off for the user. So in this case if the JS is turned off the user will be redirected tohttp://yoursite.com/nojswarning.html. of course you can change this to be any page on any site you want.