Background: At cSupport we try optimize the load as much as possible. Recently we had a request if the script could appear completely non-loading (the browser doesn’t display the load animation).
View GIST: https://gist.github.com/danschultzer/5277605
Here’s the info attached for more details.
What this does is that if you have an external script on your website which has a slow connection, this slow connection will not affect the apparent load. While a non-blocking asynchronous setup will not block the load of the webpage, it will still show up in the progress bar. What we do to prevent this, is that we first add the asynchronous load after the window has sent the load event. In Webkit I had to run it right after the load event, so there is an added 1 ms.
- Insert external script the same place as this script
- Adds an asynchronous (non-blocking) external load
- Loads the script AFTER the page itself has loaded, thus not “slowing” the load experience
- Minified function/element names
Tested with IE 9, Chrome 26, Safari 6, Firefox 19. Should work with all modern browsers.