Rendering is a term that applies to two different stages of a process.
- When ASP generates some output to send an HTTP response
- When the browser parses HTML and creates a visible view for the user
JavaScript comment, as far as ASP is concerned, is another piece of text. He does not see the difference between this and a piece of HTML or any other part of JavaScript. Therefore, in step 1, it will be transferred to the browser.
When the browser receives a response, it processes HTML and JavaScript and creates a web page for viewing by the user. When it runs JavaScript, the comment has special meaning (i.e., it should be ignored), so it is not executed.
However, this is part of the source code.
To prevent you from having to run JavaScript through the JavaScript parser on the server, delete the comments, and then output all that remains.
A common practice is to save JavaScript in external files and process them using minifier (a tool that removes unnecessary text from JS, such as comments and spaces) before deploying the site to the server.
Quentin
source share