Thanks, I use this techinque but I had issues with it in the past, I tried a few minutes now to find documentation to confirm if the onload guarantees the script is loaded and finished parsing/interpreting but I can't find it.
Your example code works in all the browsers I tested so maybe it was an issue ith th particular script I was testing, there are third party scripts like for embedding an image editor, those could also use this trick to load some dependencies.
Great. so I was wrong then, this should work with most third party scripts.
You can do this easily by creating a script element dynamically and then either:
1) Listen for the load event on that element, or
2) Have the dynamic script call a function that is already loaded.
Here is an example of the first technique:
https://jsfiddle.net/geary/szmc1L0h/9/