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