检查是否加载了html 5 shim [英] Check if html 5 shim is loaded
本文介绍了检查是否加载了html 5 shim的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们通常检查jQuery是否从CDN加载,如果没有,则回退到本地版本。
We generally check if jQuery is loaded from CDN or not and fallback to local version if it didnt.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>
我正在使用twitter bootstrap,它从加载html 5垫片googlecode
copy。
I am using twitter bootstrap, and it loads the html 5 shim from the googlecode
copy.
< script src =http://html5shim.googlecode.com/svn/trunk /html5.js\"></script>
如果没有加载,我有什么方法可以回退到本地版本 googlecode
Is there any way I can fallback to local version if it does not load from googlecode
或者我做错了什么。我不应该检查这个吗?
Or am I doing something wrong. Shouldnt be I checking this ?
推荐答案
<script>window.html5 || document.write('<script src="js/libs/your-local-version.js"><\/script>')</script>
这篇关于检查是否加载了html 5 shim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文