JavaScript缓存库:jsCache

jopen 10年前

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 : "//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 : "//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>

项目主页:http://www.open-open.com/lib/view/home/1395150428025