如何检查ajax.googleapis.com是否被阻止并使用我的jquery托管?

时间:2010-04-30 10:34:52

标签: javascript jquery

我使用http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js 但有些compaty可能会阻止这个网站,所以在这种情况下我想在jquery上使用我的本地版本 /JavaScripts/jquery.min.js。 我该怎么办?

1 个答案:

答案 0 :(得分:1)

if(typeof(jQuery) === 'undefined'){             
    var scr =   document.createElement('script');
                scr.setAttribute('type', 'text/javascript');
                scr.setAttribute('src', 'http://yourdomain/jquery.min.js');

    document.getElementsByTagName('head')[0].appendChild(scr);
    setTimeout(function(){
        // $(document).ready(); here for instance
    }, 3000);