JavaScript緩存庫:jsCache
jsCache是一個 javascript 庫,它能夠使用localStorage polyfill來緩存javascripts,css樣式和圖片。它非常適合用于移動Web網站,能夠加快網站的加載速度,節省HTTP請求和異步加所有文件。
<script type="text/javascript"> jsCache.domReady(function () { jsCache.detect("if lt IE 9", function () { // Include some IE 8 or lower specific code alert("IE 8 or lower!"); }).load( // Load bootstrap CSS and CSS fixes for old IE versions {url : "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"}, {url : "css/bootstrap-round-corners.css", detect : "if lt IE 9"}, {url : "css/bootstrap-ie7.css", detect : "if lt IE 8"}, // Load jQuery library {url : "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"} ).then(function () { // Load image and append to element that is gotten by use of jQuery! jsCache.load( { url : "images/jsCache.png", append : $("#logo")[0].firstChild, attr : { clss : "img-responsive center-block", alt : "jsCache is the most awesome caching tool!", title : "jsCache is the most awesome caching tool!" } } ); }); }); </script>
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!