I want to defer loading of an external Javascript file until the page has loaded (and also I don’t want to block rendering if those external resources cannot be loaded). So I have this line
<script type="text/javascript" src=“//external.otherdomain.com/path/js/myresoures.js" defer></script>
However, when this file does eventually load, I want to run the following …
<script type="text/javascript">_satellite.pageBottom();</script>
However, as is, the above may run before the script has loaded. How do I run the above (or any) Javascript only after a remote resource has loaded? Keep in mind that if the external resource doesn’t load (it times out, for example), I don’t want to run the Javascript.
Thanks, - Dave