开发者

What happens if you call jQuery $.getScript('myscript.js') twice?

开发者 https://www.devze.com 2023-02-14 10:25 出处:网络
I\'m caching ajax: $.ajaxSetup({ cache: true }); 开发者_C百科 And I want to know, if I call a script that\'s already been loaded, will it load a second time or not?

I'm caching ajax:

$.ajaxSetup({
  cache: true
});
开发者_C百科

And I want to know, if I call a script that's already been loaded, will it load a second time or not?

$.getScript('js/jquery.colorbox-min.js');

Thanks!


The best way to answer that is simply look at the http requests through firebug, charles or fiddler2. However, jquery.colorbox.js should not misbehave even if it is loaded twice.


It does download it twice. You can see it in Firebug

0

精彩评论

暂无评论...
验证码 换一张
取 消