Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API - Slow loading javascript

I am using Google Maps API to display a map on a certain page.

Problem is that the file http://maps.google.com/maps?file=api..... sometimes happens to load very slow - decreasing the page's performance, because the rest of the JavaScript is first loaded on document ready, which its rarely reaches - because the browser locks up waiting for the file from Google.

I have tried to move the JavaScript file from the <head> tag to under my content. But the rest of the JavaScript is never fired because the browser waits for the file from Google.

Is there a way around this, or have anyone else experienced same problem? It began recently, and I have no idea why.

This is my code, if anyone is interested:

<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAAa24xicak8_ghHX58i7La7hRFh9iM79SNC94rOejOtdMRvQmJiBS6Uv5F_1BNSh9ZuSzFXyekHISgew">    </script>
<script type="text/javascript" src="/js/maps.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
    // Google Maps
    initialize();

    // Other JavaScript comes here....

   });
</script>

If I access

http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAAa24xicak8_ghHX58i7La7hRFh9iM79SNC94rOejOtdMRvQmJiBS6Uv5F_1BNSh9ZuSzFXyekHISgew

The file loads instantly.

like image 373
janhartmann Avatar asked May 17 '09 22:05

janhartmann


People also ask

Why is my Google Maps taking forever to load?

Update Google Maps App Thus, updating the app should be your first step in fixing the slow Google Maps on your Android or iPhone. Open up the Play Store or App Store on your phone and search for Google Maps. Install any pending updates before running Google Maps again.

How can I make Google Maps load faster?

In case Google Maps takes too long to load, the first one to blame is the latest app update. As a result, you just need to uninstall the most recent version installed on the device, and going back to the original app version is one easy way to do this.

Is Google Maps API restful?

Since Google Map APIs support both json and xml , it can be safely said they they are implemented in REST.

Can you cache Google Maps API?

Customer can cache Geocoding API Place ID (place_id) values, in accordance with the Geocoding API Policies.


1 Answers

This is a rather old question now - the solution was to disable firebug (atleast for me).

like image 191
janhartmann Avatar answered Oct 17 '22 00:10

janhartmann