【问题标题】:How check if ajax.googleapis.com blocked and use my hosting of jquery?如何检查 ajax.googleapis.com 是否被阻止并使用我的 jquery 托管?
【发布时间】:2010-04-30 10:34:51
【问题描述】:

我使用http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js 但是某些兼容性可能会阻止该站点,因此在这种情况下,我想在 jquery 上使用我的本地版本 /JavaScripts/jquery.min.js。 我该怎么做?

【问题讨论】:

  • 没有一家头脑正常的公司会屏蔽ajax.googleapis.com
  • 我猜他的意思是一个可能会阻止所有传出请求的路由器
  • 不幸的是,我需要与各种头脑公司合作。

标签: javascript jquery


【解决方案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);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-11
    • 2013-07-17
    相关资源
    最近更新 更多