Andrés Orozco
Andrés Orozco

Reputation: 2671

Hide Javascript Code to Older Browser

Well I think this is kinda dumb but, I wonder if there's any way to hide Javascript code from older browsers without affecting the code for modern browsers.

Yes I know there's the <noscript></noscript> tag to show a message for older browsers, but sometimes very old browsers for any reason show the JS code as text if is not recognized.

I hope you understand.

Upvotes: 1

Views: 459

Answers (1)

Danilo Valente
Danilo Valente

Reputation: 11352

<script>
<!--
    Your code here
//-->
</script>

Upvotes: 3

Related Questions