Hide Scripts from Older Browsers
Athough most (if not all) browsers these days support scripts, some older browsers don't. If a
browser doesn't support JavaScript, instead of running your script, it would display the code to
the user. To prevent this from happening, you can simply place HTML comments around the
script. Older browsers will ignore the script, while newer browsers will run it.
HTML Code:
<script type="text/javascript"> <-- Hide from older browsers alert(" script. I ran first!") Unhide --> </script>
No comments:
Post a Comment