views:

439

answers:

1

code:

google.load("earth", "1");

function gemap_init()
{
  google.earth.createInstance('gemap', initCB, failureCB);
}

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

    console.log(ge.getPluginVersion());

    google.earth.fetchKml(ge,
      'http://example.com.au/maps/example.kml',
      function (kmlObject) {
        if (kmlObject) {
          ge.getFeatures().appendChild(kmlObject);
        }

        if (kmlObject.getAbstractView() !== null) {
          ge.getView().setAbstractView(kmlObject.getAbstractView());
        }
      }
    );
  } catch (e) {
    console.log(e);
  }
}

function failureCB(errorCode)
{
  alert(errorCode);
}

google.setOnLoadCallback(gemap_init);

for some reason this is working in every browser on my PC - but when I test on random computers and browsers around the office it is failing to display the markers or move the camera from the kml.

operating systems and browsers range from XP to Vista, and using FF, Chrome, IE7, IE8 - there is no pattern to the failure.

failing plugins are the same version as working plugins.

this is becoming a hair-pulling event for me as i just can't see where the fail is.

EDIT:

just to make clear - it is working in all those browsers and all those OSs - but not always, and not consistently...

there is no change in the javascript or kml between it working and not working.

the kml is a valid document

all browsers report that they are using the same plugin version

A: 

The comment from Fraser has reminded that this question was left open...

We have resolved the problem by appending a unique ID which is regenerated whenever the KML data on the server is updated.

This seems to bust the GE cache and we no longer have any problems with missing or out of date data being loaded in the plugin.

HorusKol