Is there a generic solution for loading a local backup CSS file when CDN is down?
<link rel="stylesheet" href="//somecdn.com/somefile.css"/>
<!-- load a local file here if needed -->
I have 5 such CSS files from different CDNs, and the order of loading matters.
The solutions I came across so far are less than satisfactory:
- create a dummy
div
and use it to check some property that should have been loaded - check
document.styleSheets[0].cssRules.length
-- this is cross-site access and not allowed by some browsers