I've been testing a lot of lazy-loaders for JavaScript and CSS that insert <script> and <link> tags to load files. However the problem is, that <link>
tags don't fire onload
so it's difficult to detect when they're loaded. The only workaround I found for this is to set display: none;
(in the CSS file that is to be loaded) on a dummy element and poll that element to check when it has been set to display: none. But that, apart from being ugly, of course only works for a single CSS file.
So I was wondering; Is there any other way to detect if a CSS file has been loaded?