A new twist ...
My current Google demo ...
http://www.macfh.co.uk/Test/Google_with_Google.html
... uses the following load order:
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?
key=<MyKey>"></script>
<script type="text/javascript">
google.load( 'maps', '2' );
google.setOnLoadCallback( onGoogleAPILoad );
...
var DOMReady = false;
var GoogleReady = false;
...
function onGoogleAPILoad()
{
...
GoogleReady = true;
if( DOMReady )
initGoogleMap( ... );
}
function init()
{
DOMReady = true;
if( GoogleReady )
initGoogleMap( ... );
}
function initGoogleMap( ... )
{
...
}
</script>
</head>
<body onload="javascript:init();" onunload="GUnload()">
...
</body>
This works in FF3, IE6, and Opera 9. After the above thread, I tried
changing it to:
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?
key=<MyKey>"></script>
<script type="text/javascript">
google.setOnLoadCallback( onGoogleAJAXAPILoad );
var DOMReady = false;
var GAJAXAPIReady = false;
var GMapAPIReady = false;
function onBodyLoad()
{
DOMReady = true;
if( GMapAPIReady )
initGoogleMap( ... );
}
function onGoogleAJAXAPILoad()
{
GAJAXAPIReady = true;
google.load( 'maps', '2', onGoogleMapAPILoad );
}
function onGoogleMapAPILoad()
{
...
GMapAPIReady = true;
if( DOMReady )
initGoogleMap( ... );
}
function initGoogleMap( ... )
{
...
}
</script>
</head>
<body onload="javascript:onBodyLoad();" onunload="GUnload()">
...
</body>
This fails in all three browsers. In FF3, there is no <body>
element. Note that this is despite specifying the callback function
in Google.load().
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---