Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do browsers today really not hide javascript?

Tags:

javascript

(This is not a duplicate of this question).

Are there any browsers today that, if they do not support javascript tags, fail to hide it? E.g., Firefox with adblock will not run javascript, but will not display it directly to the user.

This w3school tutorial claims you should hide javascript tags with comments, like this:

<script type="text/javascript">
<!--
document.getElementById("demo").innerHTML=Date();
//-->
</script>

otherwise these browsers will display the JS code. This seems a bit irrelevant today ... is it?

like image 208
ripper234 Avatar asked Dec 13 '22 13:12

ripper234


1 Answers

Are there any browsers today that, if they do not support javascript tags, fail to hide it?

Every browser that does not support <script> tags fails to hide it… but no browser on the market today fails to support <script> (even if, like Lynx, it is in the sense of "This is a script, I do not support this, I will ignore it).

Off the top of my head, I couldn't say when <script> was introduced, but it exists in the 1997 HTML 3.2 spec.

This w3school tutorial

W3Schools … err … suck.

The comment trick was provided for Netscape 2 era browsers.

It is worthless in an HTML document, and actively harmful in an XHTML document.

A while ago, I wrote about the history of this.

like image 117
Quentin Avatar answered Dec 27 '22 00:12

Quentin