Is there a recommend way to lazy load the http://www.google.com/jsapi from the html?
Adding <script type="text/javascript" src="http://www.google.com/ jsapi"> to my html will slow down the loading of my page, and I really want 'lazy load" this loader by putting them into a JavaScript file like /a.js var loader = document.createElement("script"); loader.setAttribute("src", "http://www.google.com/jsapi"); document.body.appendChild(loader); google.load(....) ... function onLoad() { } google.setOnLoadCallback(onLoad); and invoke this a.js in a code like <img src="/a.png" onclick="s=document.createElement ('script');s.setAttribute('src','/a.js');document.body.appendChild (s);"/> so the increase to the html is only ~80 bytes and if user click on that image the a.js got loaded and load the loader. However, this currently does not work because the loading the call to google.load or google.setOnLoadCallback will start before "http://www.google.com/jsapi" finish loading and therefore won't work --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en -~----------~----~----~----~------~----~------~--~---
