Thanks everybody,

to Eric Garside  : I have tried "jQuery Automatic Script Includer"
and it does not download scripts for me. Are there any known issues
that I should be aware of?

I placed this code inside of jquery.js right at the end.

(function($){
        var scripts = /\?(.*)/, files = [], path = /^.*\//, loaded = 0, count
= 0;

        $('script').each(function(){
                var src = $(this).attr('src');
                if (!scripts.test(src)) return;
                var pathto = src.match(path);
                files = files.concat($.map(src.match(scripts).pop().split(','),
function(e,i){

                        return pathto+e+'.js';
                }));
        })

        count = files.length;

        $.each(files, function(){
                $.getScript(this, function(){
                        loaded++;
                        if(loaded == count && $.isFunction(onBackload))
                                onBackload(loaded)
                })
        })
})(jQuery);

--------------------
<html>
<head>
<script type="text/javascript" src="path/to/jquery.js"></script>
</head>

<body>

<div>Test JS preloading</div>

<script src="path/to/xmlhttp.js?form,color"></script>

</body>
</html>

Reply via email to