سؤال

I'm having an issue when I run Google Earth's 3D plugin in the last version of Google Chrome, without any error messages getting caught on the callback, the div in which the ActiveX is running goes black and the only thing I can see is the terms of usage message on the bottom right. I couldn't track a reason for this to happen, but the plugin goes back alive when I resize the window, some of the causes for the black screen are:

  • When I click another javascript button (like Jquery's "accordion")
  • Sometimes on mouseover

But they are intermittent so there is no way I can track it. I also noticed that on the past version of Google Chrome the issue does not appear.

Here is the javascript loading the 3d Map:

function init()
{
google.earth.createInstance('map3d', initCB, failureCB);
}


function initCB(instance)
{
    ge = instance;
    ge.getWindow().setVisibility(true);
    gex = new GEarthExtensions(ge);
    tree_camadas = kmltree({
        url: '<url to kml here>',
        gex: gex,
        mapElement: $('#map3d'),
        element: $('#tree_camadas'),
        setExtent: false
    });
    tree_camadas.load();
    ge.getOptions().setFlyToSpeed(0.3);
    ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
    ge.getNavigationControl().setStreetViewEnabled(true);
    ge.getLayerRoot().enableLayerById(ge.LAYER_BUILDINGS, true);
    var layerRoot = ge.getLayerRoot();
    var terrainLayer = layerRoot.getLayerById(ge.LAYER_TERRAIN);
    terrainLayer.setVisibility(false);
    // Create a new LookAt
    var lookAt = ge.createLookAt('');
    // Set the position values
    lookAt.setLatitude(-22.94249);
    lookAt.setLongitude(-43.48789);
    lookAt.setRange(74482); //default is 0.0
    // Update the view in Google Earth
    ge.getView().setAbstractView(lookAt);

    reescalou();
}

function failureCB(errorCode)
{
    alert('Falha no carregamento do Google Earth Plugin!');
}
هل كانت مفيدة؟

المحلول

Curiously I had the same problem youre having, I solved it after hours of trying by upgrading jQuery and jQueryUI, I have no idea what was causing it since the GE-Plugin is not opensource and wasnt generating any error messages.

نصائح أخرى

The phenomenon can be reproduced definitely (chrome 32.0.1700.107 m), without jquery:

<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
</head>

<script type="text/javascript">
var ge;

google.load("earth", "1", {"other_params":"sensor=false"});

function init()
{
  google.earth.createInstance('Earth', initCB, failureCB);
}

function initCB(instance)
{
    ge = instance;
    ge.getWindow().setVisibility(true);
}

function failureCB(errorCode){}

google.setOnLoadCallback(init);

</script>


<body>

  <div id="Earth" style="width:600px;height:250px"></div>
        <a href="http://www.google.com">Test.</a>

</body>

</html>

Touch the anchored text by mousepointer AFTER you did call Developer Tools on undocked window.

Sorry, my reputation is not enough to add comments, so I was forced to enter here.

This looks to be a Google Chrome version 32 issue. For my site I used a "Click here if you do not see Google Earth" link that fires a pop-up. (Works similar to developer tool) Additional information... Similar behavior is occurring with some sites that use Silverlight with Chrome 32. Same solution works. Finally, the same blank div activity for Google Earth plugin and silverlight looks to be resolved in Google Chrome 33 beta. My site, that uses Google Earth plugin is back to normal (working) with Google Chrome version 33 beta.

Example Script (I had to refresh Browser to initiate other code, but you might not have to.)

$(document).ready(function(){
var a = document.getElementById("**LINK ID HERE**");
      a.onclick = function() {
window.open("http://**EnterPopUpUrlHere**.html","help","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=573px,height=700px,left = 360px,top = 125px");
 window.location.reload();
}; });
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top