Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps load issues on PHP page
    text
    copied!<p>I'm connecting a Google Map to a MySQL database to list distributors all over the world, and I seem to be having a few issues.</p> <ol> <li>Sometimes the page itself will not load at all in Firefox (v4 on Mac). It's temperamental on my machine (FF v3.6 Mac) and a Windows machine (FF v4 Win 7), ok in Safari/Opera, doesn't load at all in IE 9 (Win 7). Not sure if it's a network issue or code.</li> <li>Load time is pretty slow. Might be because the map covers the whole page (will create a square block to place it in).</li> </ol> <p>The URL of the page is <a href="http://www.cloud.co.uk/test/dmap.php" rel="nofollow">here</a> and I used the code from <a href="http://sean-feeney.com/2011/03/php-google-maps-geocoder-tutorial.html" rel="nofollow">Sean Feeney's page.</a></p> <p>The code I have is:</p> <pre><code>&lt;script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=&lt;I entered my key here&gt;" type="text/javascript"&gt;&lt;/script&gt; &lt;body onUnload="GUnload()"&gt; &lt;div id="map" style="position:absolute;top:0px;bottom:0px;left:0;right:0;"&gt;&lt;/div&gt; &lt;/body&gt; &lt;script type="text/javascript"&gt; //&lt;![CDATA[ var map; var latlngbounds; if (GBrowserIsCompatible()) { function createMarker(point, address) { var marker = new GMarker(point); var html = address; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } function extendBounding(point) { latlngbounds.extend(point); var zoom = map.getBoundsZoomLevel(latlngbounds); if (zoom &lt; 10) { zoom = 12; } map.setCenter(latlngbounds.getCenter(), zoom); } } map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl3D()); map.addControl(new GMapTypeControl()); latlngbounds = new GLatLngBounds(); GDownloadUrl("genxml.php", function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i &lt; markers.length; i++) { var address = markers[i].getAttribute("address"); var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var marker = createMarker(point, address); map.addOverlay(marker); extendBounding(point); } }); } //]]&gt; &lt;/script&gt; </code></pre> <p>The code that gets the data is the same as the example.</p> <p>Any ideas as to why it doesn't always load in the browsers, and why it seems to take a while to load?</p> <p>Thanks,</p> <p>Adrian</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload