0

I have a large HTML file being generated for a report at the moment (around 2-3 mb) and this file is going to be transferred a lot of times. It is not being access through any form of a web host, it is just a file being accessed by a network, but the network is all around the world and therefore not fast everywhere.

I know about gzip compression, but from the looks of it that will only work with an apache web server or something similar to configure it via the .htaccess file. I have already stripped the white spaces from the HTML file, my question is besides just zipping it up in a standard archive, what else can I do to minimize the size of the file?

Thanks, and I will be happy to answer any other questions.

casperOne
  • 73,706
  • 19
  • 184
  • 253
MasterGberry
  • 2,800
  • 6
  • 37
  • 56
  • [You've been able to gzip your content in IIS for both static and dynamic content since version 6.](http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true) – casperOne Jul 31 '12 at 15:12
  • This page is being designed in C#, which is why i tagged the C# in order to allow any C# plugins to be used. – MasterGberry Jul 31 '12 at 15:13

3 Answers3

2

You can certainly look at the HTML structure itself to see if you can reduce the number of tags themselves. For example to you have a bunch of nested table structures that could be replaced? Do you have inline styles that could be put into a separate stylesheet? Do you have any javascript content which could be put into a separate file?

Mike Brant
  • 70,514
  • 10
  • 99
  • 103
  • All of the javascript and CSS is in the header (was designed in a style sheet and then copied and pasted inside), and the HTML is as minimize as the tags can get, the majority of the HTML isn't HTML, but rather raw data of logs filled with text. Is there any way to compress this and have the browser recognize it automatically without an apache server sending a special header? – MasterGberry Jul 31 '12 at 15:12
1

I does not think that you can compress it without a proper web server, because is the web server that say to the browser that the file is to unzip in the HTTP response.

If the format is the greater part of the file (i.e. there are more tags and script than the text) you can use a css to minimize the size.

If the data is the greater, so information are the more than tags, I suggest you to use a web server (also with the Microsoft IIS you can compress it)

But, if possible, consider also to split the data in several file, with different level of details for example

Community
  • 1
  • 1
0

It is possible to contain compressed data within the HTML file and use a JavaScript to dynamically compress the data as the page is rendered using a JavaScript implementation of the Decompression module. See this answer for references: JavaScript implementation of Gzip

Community
  • 1
  • 1
Ujjwal Singh
  • 4,908
  • 4
  • 37
  • 54