Abseseemima
New Member
I have a site that loads CSS and fonts from Google Web Fonts. However, one place where the site will be used is a local intranet with no Internet access.I still want to use the fonts from Google where I can for the benefits that Google offers, such as the fonts being downloaded from a CDN and possibly already being cached on the user's computer from visits to another site that uses them.I also use Google-hosted jQuery and I use the following code (from HTML5 Boilerplate) to load jQuery from my server if Google is not accessible:\[code\]<script src="http://stackoverflow.com//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script><script>window.jQuery || document.write('<script src="http://stackoverflow.com/questions/14392438/js/vendor/jquery-1.9.0.min.js"><\/script>')</script>\[/code\]I am looking for a way to do the same for CSS files.I have used \[code\]<img src="http://stackoverflow.com/questions/14392438/..." onerror="..." />\[/code\] in the past for handling images that don't load, so I was wondering if I can use that for stylesheets that don't load too. I did a quick test in a few browsers, using \[code\]<link href="http://stackoverflow.com/questions/14392438/..." onerror="..." rel="stylesheet" type="text/css" />\[/code\], and the \[code\]onerror\[/code\] was executed in all of them, but I would like to find out if I can expect this to work consistently in all browsers. Or is there a better way to do it?I saw several other answers here that discuss watching the \[code\]document.styleSheets\[/code\] collection, but that sounds like much more of a hack than this does.Note: This is really more of a "is this practical and do people use it"-question than a "what does the spec have to say about it"-question.