1.使用cdn加载jquery文件,判断是否加载成功,如果没有成功,则使用本地的jquery文件,代码如下:
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='/js/jquery-1.4.2.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
原文链接:https://css-tricks.com/snippets/jquery/fallback-for-cdn-hosted-jquery/
最后
以上就是忧郁蜡烛最近收集整理的关于jquery使用cdn加载问题的全部内容,更多相关jquery使用cdn加载问题内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复