开发者

Performance in HTML

开发者 https://www.devze.com 2022-12-14 13:40 出处:网络
how to ma开发者_如何学Cintain Version for css and Java script in html how to compress java script in run timeTo compress Javascript in runtime, you can call a server-side page which read your javascr

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

精彩评论

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

关注公众号