iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register

Go Back   WebForumz.com > Resources > FAQ > (X)HTML & CSS
Register All Albums Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Author


Jack Franklin
Jack is 15 years old and lives happily in Cornwall, England. Web Design is his passion and he works using xHTML, CSS and PHP to code his websites, with the odd bit of Javascript now and then. In his spare time, Jack enjoys playing Football, rugby, tennis and snooker (but not all at the same time).

RSS Feed

Your Options
Display text if user has javascript off, but not when it's turned on?

Need a way of telling people to turn on javascript but only to those who need telling?

This is a very easy to solve problem. There is actually a html tag which does exactly that. It's called the <noscript> tag. The noscript tag is used to define alternate content, usually text, when a script does not execute. Please note however, if your script does not run, but the browser supports javascript, then the text in the <noscript> tag will not display either.
To use the <noscript> element, place it after your <script> tag.

<script type="text/javascript"> 
<!--
document.write("Hello World!")
//-->
</script>
<noscript> Your browser does not support JavaScript!</noscript>

Remember, you should wrap the script in a HTML comment, because older browsers which do not recognize the <script> tag would display the code on the page, but because of the HTML comment they would take the script and place it inside a HTML comment, so it will not actually display.


Related Resources

Members's Comments
Posted at June 26th, 2008 by moojoo
<noscript> can also be used in correct locations within your document to show a xhtml.css fall back to a js provided content area. I implemented this partially on us.iams.com, if you look at the left flash element and disable js or uninstall flash it will degrade 100% with absolutely no visual difference other than the animation loss.
Page 1 of 1


Search Engine Optimization by vBSEO 3.2.0 RC8