/ Published in: jQuery
Handy little snippet i found in 'jquery enlightenment' for caching certain selected files. Could be useful for larger files later on in a site.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(function($){ $(window).load(function(){ //Wait for the page to load, the cache the files you want $.ajax({url:'javascript.js', dataType:'text'}); $.ajax({url:'image.jpg', dataType:'text'}); $.ajax({url:'flash.swf', dataType:'text'}); $.ajax({url:'style.css', dataType:'text'}); }); })(jQuery);