williamrouse Posted February 2, 2010 Report Share Posted February 2, 2010 How do you warn a website visitor that they need to enable JavaScript to enter a website? Are there any example sites or example code? Quote Link to comment Share on other sites More sharing options...
PicnicTutorials Posted February 2, 2010 Report Share Posted February 2, 2010 Put something in tags. It will only show when js is off. Quote Link to comment Share on other sites More sharing options...
williamrouse Posted February 2, 2010 Author Report Share Posted February 2, 2010 Thanks Eric Quote Link to comment Share on other sites More sharing options...
monkeysaurus Posted February 2, 2010 Report Share Posted February 2, 2010 As per the W3 spec, this isn't the purpose of the tag. The tag should be used to provide alternative content when a script is disabled; it shouldn't be used to tell the user to switch javascript on. What if the user can't switch javascript on? What if they're browsing on a mobile user-agent? What if they're using a screen reader, or a dozen other devices that don't support javascript? What about search robots trying to index your site? These days there's no excuse not to use progressive enhancement techniques; develop your site so that it's fully accessible with javascript off, then use javascript to put the icing on the cake. The proper strategy to do what you're suggesting would be something like: Develop the site so that it is fully functional with Javascript off Add a div to the top of the page inviting users to switch javascript on for a better user experience Hide that div using javascript on page load. That way, everybody sees content, and users who can get a better experience, will. For an example of how it should be done, check out Stack Overflow with js on and off. Quote Link to comment Share on other sites More sharing options...
PicnicTutorials Posted February 2, 2010 Report Share Posted February 2, 2010 (edited) For an example of how it should be done... http://www.visibilityinherit.com/code/add-css-with-javascript.php Edited February 2, 2010 by Eric Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.