CodeClerks

How do I hide javascript code from old browsers?



Write the reason you're deleting this FAQ

How do I hide javascript code from old browsers?

Please explain how it's possible to hide javascript code from older browsers that don't support javascript or for users who have javascript turned off in their browsers.

Comments

Please login or sign up to leave a comment

Join
jakemadness
Maybe using if's could solve the problem?
<!--[if lt IE 9]><script>window.location = 'http://google.com/chrome' : alert('Please consider upgrading you\'re browser!');</script> <![endif]--> etc etc. . . . .



Are you sure you want to delete this post?

jakemadness
Sorry above is incorrect, If you place "<!--" at start of the script and "//-->" at the end of the script it will not show the script as text in browser's that do not support javascript example.

<script type="text/javascript">
<!--
alert("hello world");
//-->
</script>
 


The "//" tells the javascript to stop reading so it doesn't read the html comment tag.



Are you sure you want to delete this post?