Hi, im trying to write some quite concise embed code and, if possible, i would like to load the google jsapi dynamically. I have followed the approach used here:
http://stackoverflow.com/questions/950087/include-javascript-file-inside-javascript-file
function loadScript(url, callback) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.onreadystatechange = callback;
script.onload = callback
head.appendChild(script);
}
loadScript("http://www.google.com/jsapi",fire);
function fire() {
//do suff
}
The trouble i am having is that my screen seems to go white after loading. I catch a glympse of the page but it goes white after what i assume is the javascript loading…perhaps stuck in a loop but i have no idea why.
Thanks,
Nick