Display text if user has javascript off, but not when it's turned on?
Display text if user has javascript off, but not when it's turned on?
Published: Feb 1st, 2008
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.
Members's Comments & Rating
Posted at
Jun 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