Skip to content

Instantly share code, notes, and snippets.

@frozonfreak
Created August 6, 2013 05:20
Show Gist options
  • Save frozonfreak/6162217 to your computer and use it in GitHub Desktop.
Save frozonfreak/6162217 to your computer and use it in GitHub Desktop.
CDN fallback script for CSS
<script type="text/javascript">
$.each(document.styleSheets, function(i,sheet){
if(sheet.href=='http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css') {
var rules = sheet.rules ? sheet.rules : sheet.cssRules;
if (rules.length == 0) {
$('<link rel="stylesheet" type="text/css" href="path/to/local/jquery.mobile-1.0b3.min.css" />').appendTo('head');
}
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment