useful anymore", "text": "<p>I'm reviewing some html produced by an overseas development shop for us. They are using comments inside their external script loading tags - so far as i'm aware this was only useful for very old javascript unaware browsers who used to render the scripts as text - is there any modern purpose for this or is it now completely redundant?</p>\n\n<pre class="prettyprint"><code>&lt;script type="text/javascript" src="path/to/file.js"&gt;&lt;!--//--&gt;&lt;/script&gt; \n</code></pre>\n\n<p>Thanks in advance</p>\n\n<p>//Update after comments below: It turns out that the comments were hacking a problem in the Content Management System where it would render the tag as</p>\n\n<pre class="prettyprint"><code>&lt;script type="text/javascript" src="path/to/" /&gt;\n</code></pre>\n\n<p>without the comments present - so the answer is that they nolonger have any use in general web development but there are some specific circumstances where they may be useful. Kudos to Caspar Kleijne for pointing this out.</p>", "answerCount": 1, "upvoteCount": 895, "dateCreated": "2023-01-21 04:15:18", "dateModified": "2023-01-24 02:48:28", "author": { "type": "Person", "name": "toomanyairmiles" }, "acceptedAnswer": { "@type": "Answer", "text": "<p>No, it's not useful any more.</p>\n\n<p>It was used way back when there still existed browsers that were shipped before Javascript existed. Nowadays every browser is aware of the existance of Javascript, even if they don't support it.</p>\n\n<p>If someone still would have such an ancient browser isntalled, your page will look so terribly crappy in it that it doesn't make any difference.</p>", "upvoteCount": 170, "url": "https://exchangetuts.com/is-script-script-useful-anymore-1641662823851495#answer-1674447318840919", "dateCreated": "2023-01-23 12:48:28", "dateModified": "2023-01-24 02:48:28", "author": { "type": "Person", "name": "Guffa" } } } }
Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is <script><!--//--></script> useful anymore

I'm reviewing some html produced by an overseas development shop for us. They are using comments inside their external script loading tags - so far as i'm aware this was only useful for very old javascript unaware browsers who used to render the scripts as text - is there any modern purpose for this or is it now completely redundant?

<script type="text/javascript" src="path/to/file.js"><!--//--></script>  

Thanks in advance

//Update after comments below: It turns out that the comments were hacking a problem in the Content Management System where it would render the tag as

<script type="text/javascript" src="path/to/" />

without the comments present - so the answer is that they nolonger have any use in general web development but there are some specific circumstances where they may be useful. Kudos to Caspar Kleijne for pointing this out.

like image 895
toomanyairmiles Avatar asked Jan 21 '23 04:01

toomanyairmiles


1 Answers

No, it's not useful any more.

It was used way back when there still existed browsers that were shipped before Javascript existed. Nowadays every browser is aware of the existance of Javascript, even if they don't support it.

If someone still would have such an ancient browser isntalled, your page will look so terribly crappy in it that it doesn't make any difference.

like image 170
Guffa Avatar answered Jan 24 '23 02:01

Guffa