Posted By

brianyang on 07/07/10


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

sethetter
brandonjp
tennison


load library script


 / Published in: JavaScript
 

  1. function loadLibrary(){
  2. var script = document.createElement('script'), url = partnerUrl;
  3. script.src = url;
  4. document.getElementsByTagName('head')[0].appendChild(script); // safer to add new script nodes to head element since IE may show operation aborted
  5. script.onload = function(){ // Firefox, Opera, Chrome, and Safari 3+
  6. init();
  7. };
  8. script.onreadystatechange = function(){ // in IE
  9. if (script.readyState == "loaded" || script.readyState == "complete") {
  10. script.onreadystatechange = null;
  11. init();
  12. }
  13. };
  14. };

Report this snippet  

You need to login to post a comment.