5 Replies Latest reply: Jul 19, 2013 11:00 AM by Bradley Coyne RSS

    Extensions problem with external JS

      Hi All,

      I have a little challenge with extensions. I am trying to include the GoogleMaps API. I know the solution on static maps but this is not satisfaying enough for my needs. Therefore I thought about writing my own extension. But for some reason I can't get it working. The below is a simplified extract, which simply loads the JS script from Google and then should create an object based on the Google API. Unfortunately, the execution stops after the alert("in") statement. I believe the latlng object can't be created because the Google Javascript is unknown (although loaded before).

      Any ideas? Here is the code...



      Qva.AddExtension('GoogleMaps', function() {

      var script = document.createElement("script")

      script.setAttribute("type", "text/javascript");

      script.setAttribute("src", "http://maps.google.com/maps/api/js?sensor=true");


      script = document.createElement("script");

      script.setAttribute("type", "text/javascript");



      alert (this.Element.innerHTML);






      function initialize() {

      alert ("in");

      var latlng = new google.maps.LatLng(48, 8);


      var myOptions = {

      zoom: 4,

      center: latlng,

      mapTypeId: google.maps.MapTypeId.SATELLITE