Forum Moderators: phranque

Message Too Old, No Replies

Is Commented out html a problem

Html code that is not rendered by browser

         

scooterdude

5:46 pm on Dec 29, 2010 (gmt 0)

10+ Year Member



Sometimes i apply

<!-- some html code -->

instead of deleting the code altogether, often because i like to see what was there before and might reuse some of the code.

maximillianos

6:07 pm on Dec 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think it is a problem. Comments are ignored by browsers and search bots, etc. However if use a scripting language like PHP or Perl, etc, you can also simply comment out the script that generates the HTML and it will never be seen by browsers, and you retain the history in your source files.

rocknbil

6:24 pm on Dec 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are only two issues when used this way - if the commented out code is of any significant size, it may be easy to get lost (hard to debug,) and the comments do take up space so it increases the file's size. I generally have a working version and a deployment version to avoid both.

topr8

9:05 pm on Dec 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



there is a third issue:

you may inadvertantly leave comments or code which may be useful in some way to a nefarious user ... (footprints, default form values, overdescriptive notes etc)

as rocknbil says deployment code for webpages should have all comments removed