4 ms·
The only reason is so that you can use the browser's native async and defer script scheduling. And yes, you need to modify the external scripts (only adding a s
by Sephr 16y ago
The only reason is so that you can use the browser's native async and defer script scheduling. And yes, you need to modify the external scripts (only adding a single line to the start and end).
If you can't convince the widget provider to change the script, you can place <script>document.write.to = "the URI of the following widget script";</script> right before the widget script itself.
Also, on your fixed loading time thing: with onload, it still won't run until every image and iframe on your website has loaded too.
- rarestblog 16y agoHow many browsers support 'document.write.to'? It uses browser-specific event. onload is fallback. I've tested the slow image (20 second delay instead of image) - no, it doesn't require loading of images, scripts fire up as soon as HTML finishes loading. Sorry.
- Sephr 16y agodocument.write.to isn't something used by any browsers, it's something that my asynchronous document.write library uses instead of polluting the global namespace. Those image results are interesting, and I admit that I only took a quick skim of your code, so I may have been wrong to assume that it would be limited by onload.
- rarestblog 16y agoIt was. Thank you for noting that. It was your comment that made me look into window.onload and scrape it, replacing with more sophisticated browser-specific code. Thank you!