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

Go Back   WebForumz.com > Resources > Tips & Tricks > (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
How can I display the text 'Please turn your javascript on' if the user does not have javascript on, but not display the message to those who do?

If your javascript fails to work because it is turned off on the visitor's PC, they need to know about it!

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 No Comments. Be the first to comment on and rate this resource.


Search Engine Optimization by vBSEO 3.2.0 RC8