title: Loading kml files into the google-earth-plugin on a web-hosted page
body: <p>Try as I might, I seem unable to access kml files from an instance of the google-earth-plugin on my publicly-hosted web page. Using all the google developer help I can find and trying Fetchkml as well as kmlNetworkLink with no success, I have tried to approach the problem in a one-step-at-a-time way and reached the following impass:</p>
  
  <p>Using the following javascript code <em>works</em> when I point to a kml source at code.google.com:</p>
  
  <p><code></p>
  
  <pre><code>    google.load("earth", "1");
      var ge;
      function init() {
          google.earth.createInstance('mapthreedee', initCB, failureCB);
      }
      function initCB(instance) {
          ge = instance;
          ge.getWindow().setVisibility(true);
          ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
  
          var link = ge.createLink('');
          var href = 'http://code.google.com/apis/earth/documentation/samples/kml_example.kml';
          link.setHref(href);
  
          var networkLink = ge.createNetworkLink('');
          networkLink.set(link, true, true); // Sets the link, refreshVisibility, and flyToView
  
          ge.getFeatures().appendChild(networkLink);
   }
           function failureCB(errorCode) {
      alert("failure");
      }
  
      google.setOnLoadCallback(init);         
  &lt;/script&gt;
  </code></pre>
  
  <p></code></p>
  
  <p>The google-earth plugin zooms down to San Fransisco. However, if I download this same kml_example.kml source file using google Chrome, place the untouched kml file into my google docs document space, get the relevant id address for it and paste this address into the javascript code on my web page (with no other changes to the code at all), like so:</p>
  
  <p><code></p>
  
  <pre>    google.load("earth", "1");
      var ge;
      function init() {
          google.earth.createInstance('mapthreedee', initCB, failureCB);
      }
      function initCB(instance) {
          ge = instance;
          ge.getWindow().setVisibility(true);
          ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
  
          var link = ge.createLink('');
          var href = 'https://docs.google.com/open?id=0B3kCsTNlhwBaM2I5YTk0ZjEtOGVlNS00MGU4LTk5MTgtYTUyYzQ2Mzc2Mzhl';
          link.setHref(href);
  
          var networkLink = ge.createNetworkLink('');
          networkLink.set(link, true, true); // Sets the link, refreshVisibility, and flyToView
  
          ge.getFeatures().appendChild(networkLink);
   }
           function failureCB(errorCode) {
      alert("failure");
      }
  
      google.setOnLoadCallback(init);         
  &lt;/script&gt;&lt;/code&gt;
  </code></pre>
  
  <p>No kml is accessed when the page loads, although the google-earth-plugin still loads correctly. I am only going to these extremes because a kmz location (in Norway) I have in google docs, which I can access perfectly well via Network Link in the google Earth client on my PC, does not appear in the google-earth-plugin when I try to access it using identical code to the above.</p>
  
  <p>Can anyone point me in the right direction?</p>
  
  <p>These web pages are at <a href="http://geoffreychaucernm.co.uk/offlineTEST_SITE_ghp/googlemaps/googleEarth_3.html" rel="nofollow">http://geoffreychaucernm.co.uk/offlineTEST_SITE_ghp/googlemaps/googleEarth_3.html</a> and <a href="http://geoffreychaucernm.co.uk/offlineTEST_SITE_ghp/googlemaps/googleEarth_4.html" rel="nofollow">http://geoffreychaucernm.co.uk/offlineTEST_SITE_ghp/googlemaps/googleEarth_4.html</a></p>
  
  <p>The site is hosted on a 1and1 Microsoft web server. </p>