mercredi 27 mai 2015

Google Maps not showing on webpage but shows on localhost

So I'm trying to implement Google maps on a website, and on my localhost it works fine, and I see it perfectly. However when I upload this to my hosting company, the map doesn't show at all. When I inspect the element and check the console, I don't see any errors. Code is below:

    <script type="text/javascript" src="http://ift.tt/1CzOMXn"></script>
    <script>
      function initialize() {
        var mapCanvas = document.getElementById('map-canvas');
        var myLatlng = new google.maps.LatLng(53.092975, -7.895479);

        var mapOptions = {
          center: myLatlng,
          zoom:16,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

        var marker = new google.maps.Marker({
          position: myLatlng,
          map: map,
          title: 'LCCEurotex'
        });


      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>

I have no idea what could be causing it as my code looks the same as the one from the google documentation. Any ideas on what could be causing it would be great. Thanks for any help




Aucun commentaire:

Enregistrer un commentaire