geoaxis
geoaxis

Reputation: 1560

big Fat HTML5 app..which contains every thing (CSS, images, JS libraries) in one file alone. Possible?

Is there a way to package an HTML5 app into one file which the browser can open and every thing that needs to be there is there. I guess it is some what of an anti-thesis of a webapp which you can update as you go along. But this could be useful. You can think of it as an exe or jar file but all done in one big fat HTML5 app.

For the sake of simplicity I am ok with the app working on one browser only (and it can be the nightly-build version)

Upvotes: 1

Views: 264

Answers (1)

tucuxi
tucuxi

Reputation: 17945

Yes, it is possible. Just deliver a single HTML file with

<STYLE type="text/css">
   H1 {border-width: 1; border: solid; text-align: center}
</STYLE>

Within the head section. Do the same for JS:

<SCRIPT type="text/javascript">
   //...some JavaScript...
</SCRIPT>

And you are done. Images can be included within JS, HTML or CSS by using data uris:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot">

Beware that they are somewhat limited - for instance, it seems that IE8 does not like more than 32Kb's worth of data in a single one.

Upvotes: 2

Related Questions