Automatically Compact HTML on render

  • Thread starter Thread starter Untitled
  • Start date Start date
U

Untitled

Is there a component that i could use to automatically compact (remove
white spaces, new lines maybe, etc..) the rendered HTML pages?

When writing HTML, developers like to add spaces and newlines to make
the code more readable. When a single space is added to a datagrid
control, and this datagrid control has renders a 1000 items, this adds
1000 useless spaces to the HTML output.

Is there any way to get arround this? To have ASP .NET automatically
compact/compress the html before it is sent to the client browsers?

Thanks

Mark
 
I think i rather use a compactor. But that's only because i don't
really understand how a compressor would work. I mean how does the
browser know to decompress the HTML output? And if it does know to do
so, how does it know what algorithm to use?
 
Compression is supported by HTTP. When the browser sends a request, it
tells the server which type of compression is supports (gzip or deflate).
Http compression modules (like the one I provided a link to), read this and
compress the output accordingly and tell the browser how it was compressed.
The browser then compresses it. If the browser doesn't send a header with
the type of supported compression, nothing happens. In other words, it's
baked into HTTP and the browsers. The specific module is simply a .Net
implementation for use specifically in ASP.Net projects.

It's true that the content won't always be compressed (when the browser
doesn't support it), but most modern browser do support it....and compared
to a compactor, it'll make a much bigger difference in the file size.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
Back
Top