Hi
I'm trying to use Google Earth API from XHTML document. I'm using FF3.
When the file extension is .xhtml, I get following error:
google.earth.createInstance is not a function
There is another exception printed in Error console:
Error: uncaught exception: Operation is not supported
(NS_ERROR_DOM_NOT_SUPPORTED_ERR)
Source File:
http://www.google.com/jsapi?key=ABQIAAAAI6LZmD-FqAZVeamTjScGYhR0dDjxwEiZwld2-1_s6au4o9PdThTNZavQNg3-bLYRiD8InUQfkpwJPg
Line: 20
Here is the problematic line:
k[v].d=function(a,b,c){if(c){var d;if(a=="script"){d=m.createElement
("script");d.type="text/javascript";d.src=b}else if(a=="css")
{d=m.createElement("link");d.type="text/
css";d.href=b;d.rel="stylesheet"}var f=m.getElementsByTagName("head")
[0];f||(f=m.body.parentNode.appendChild(m.createElement
("head")));f.appendChild(d)}else if(a=="script")m.write('<script
src="'+b+'" type="text/javascript"><\/script>');else a=="css"&&m.write
('<link href="'+b+'" type="text/css" rel="stylesheet"></link>')};
If I rename .xhtml to .html, everything is OK. See the sample file
below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<!-- Google Earth initialization -->
<script type="text/javascript" src="
http://www.google.com/jsapi?
key=ABQIAAAAI6LZmD-
FqAZVeamTjScGYhR0dDjxwEiZwld2-1_s6au4o9PdThTNZavQNg3-
bLYRiD8InUQfkpwJPg"> </script>
<script type="text/javascript">
//<![CDATA[
google.load("earth", "1");
var ge = null;
function geInit()
{
google.earth.createInstance("map3d", initCallback, failureCallback);
}
function initCallback(pluginInstance)
{
ge = pluginInstance;
ge.getWindow().setVisibility(true); // required!
}
function failureCallback(errorCode)
{
alert("Failure loading the Google Earth Plugin: " + errorCode);
}
//]]>
</script>
</head>
<body onload="geInit()">
<div id="map3d_container" style="border: 1px solid silver; height:
400px; width: 600px">
<div id="map3d" style="height: 100%;"></div>
</div>
</body>
</html>