Hiding your Javascript

Question: Can I add JavaScript code that will keep an error message from displaying on computers that have JavaScript disabled?
Joel Benjamin

Answer:You can avoid having your JavaScript display as text on browsers that don't support JavaScript by making all of your JavaScript external to the page. Place them in files with a .js extension and access them like this:

<script type="text/javascript" src="myscript.js"></script>

The script will then only be included when JavaScript is enabled.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow