开发者

Performance in HTML

how to ma开发者_如何学Cintain Version for css and Java script in html

how to compress java script in run time


To compress Javascript in runtime, you can call a server-side page which read your javascript file, minimize and cache it and return your compressed file. So you'll have to do something like:

<script src="Minimize.aspx?YourJavascriptFile.js"></script>

But, if you compress it before upload, you can save some processor cycles and memory.


To remove javascript and css cache, you can add a version number after the file name:

<script src="MyMinimizedScript.js?version=1"></script>

when you change the javascript (or do the same for css), just change the version number. Your file name does not need to change.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜