JSFiddle - React, Tailwind, and code Playground
HTML
<link id="Link1" rel="stylesheet" type="text/css"
href="http://cdn.sstatic.net/stackoverflow/all.css"
onload="handle404Error(this)"
onerror="handle404Error(this, true)"
/>
<div id="output"></div>
JavaScript
var output= document.getElementById('output');
function handle404Error(el, failed) {
if(failed || (el.sheet.cssRules && !el.sheet.cssRules.length)) {
output.innerHTML= output.innerHTML + el.id+ ': '+ el.href+' failed to load!<br>';
}
else {
output.innerHTML= output.innerHTML + el.id+ ': '+ el.href+' loaded successfully!<br>';
}
}