0
我緩存的ajax:
$.ajaxSetup({
cache: true
});
而且我想知道,如果我叫一個已經被加載腳本,將其加載第二次或沒有?
$.getScript('js/jquery.colorbox-min.js');
謝謝!
我緩存的ajax:
$.ajaxSetup({
cache: true
});
而且我想知道,如果我叫一個已經被加載腳本,將其加載第二次或沒有?
$.getScript('js/jquery.colorbox-min.js');
謝謝!
回答這個問題的最佳方法是通過firebug,charles或fiddler2來查看http請求。但是,即使裝入了兩次,jquery.colorbox.js也不應該行爲不端。
它下載兩次。你可以看到它在Firebug
相關:http://stackoverflow.com/questions/424073/how-to-determine-if-a-javascript-was-already-loaded-by-other-html-file – Orbit 2011-03-02 02:41:44