Is it possible to include a javascript file which is in a zipped file?
Just like we include a javascript file in html 开发者_如何学运维
<script language="JavaScript1.2" src="CommonFunctions.js" type="text/javascript">
In this case 'CommonFunctions.js' is placed in current directory. Can we include a javascript file which is inside a zipped file?
Some people want this functionality, but currently it isn't supported.
I don't believe it's very useful either - if you zip all JS and CSS, how can you cache parts of them on the local machine? There is already GZIP too, and minification.
Images also won't make much or possibly overhead by being zipped if they are in a compressed format like PNG.
Well the answer is no.
No, you need to unzip the file beforehand.
If you want to compress it before sending it to the browser, there are utilities to compress javascript (yui compressor, etc), and also gzip, which allows you to send compressed files across the internet before reaching the webbrowser.
精彩评论