Why are javascript comments loaded into the browser?
This is why production environments usually minify / package Javascript files. This removes unnecessary spaces and comments.
But if the comments are in the HTML file itself (or in the HTML document rendered to the ASP.NET page), the server must either send the comments to the client or take an extra step to remove them. The problem is that this process can be relatively expensive as you basically have to parse the HTML output to figure out where the Javascript is and then where the comments are. It's not as easy as finding and replacing a regex (not if you want it to be reliable anyway).
source to share
As asp.net does not compress / preprocess js files before sending it to client. You need to use something like YUI Compressor for this .
source to share
1) compress javascript before deploying. This is good anyway, because you can get a sharp reduction in size even after removing comments.
2) if you do have some random bits of javascript lying around your aspx file, you might consider using server side asp <% - -%> comments instead, as opposed to HTML client comments or javascript comments //, t sent by wire.
source to share