Preload All Images Defined in the Stylessheets with Javascript

(function(){
    var styles, matches, match, url, img = new Image(), loaded = [];
    function forEach(a,c){if(a&&c){for(var i=0;i<a.length;++i){c.call(a[i])}}};
    forEach(this.styleSheets, function(){
        forEach(this.rules, function(){
            forEach(styles=this.style, function(){
                if(this.toString() !== 'background-image')return;
                if(!(matches=styles[this].match(/url\([^\)]+\)/g)))return;
                forEach(matches, function(){
                    if(!(match=this.match(/url\(([^\)]+)\)/)))return;
                    if(loaded.indexOf(url=match[1]) !== -1)return;
                    loaded.push(img.src = url);
                });
            });
        });
    });
}).call(document)

Source