Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if html 5 shim is loaded

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>

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>

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 ?

like image 581
Jashwant Avatar asked Jul 01 '12 12:07

Jashwant


1 Answers

<script>window.html5 || document.write('<script src="js/libs/your-local-version.js"><\/script>')</script>
like image 194
Vladimir Kadalashvili Avatar answered Sep 19 '22 20:09

Vladimir Kadalashvili