Do we still need to use the HTML comments for script blocks or has that been revised?
Printable View
Do we still need to use the HTML comments for script blocks or has that been revised?
I don't think it's really necessary now, unless you want to serve content for really old browsers.
They were used for IE3 / NN 2 and older browser versions (not sure if these are the correct versions). They didn't understand JavaScript (actually the script-tag), and would've displayed the JS code as HTML content. Commenting the code out was the only way to prevent it.
For this purpose the noscript-tags were invented. Old browsers didn't understand those neither, so they'd display all content in between, while newer browsers skipped the content.
I've given up on supported browsers that don't run Javascript. Granted, I don't do anything truly fancy with it, so older browsers will just not have small functionality. If you haven't upgraded your browser in the past 3-4 years, then I don't feel sorry for you.