Google Maps API - Slow loading javascript

前端 未结 3 1939
无人及你
无人及你 2021-02-05 23:11

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

相关标签:
3条回答
  • 2021-02-05 23:56

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

    0 讨论(0)
  • 2021-02-05 23:56

    On JavaScript optimization: always put your JS at the bottom of your even your Maps API script. I can't really think of any good reason to have any JS in the head.

    0 讨论(0)
  • 2021-02-05 23:58

    Use Google's Ajax APIs. From some time past, all of Google's services can be accessed through the JavaScript API. It's a modular system, you only have to include the JSAPI library, and then you can dynamically load the modules you need—it won't block your site.

    <script type="text/javascript"        
            src="http://www.google.com/jsapi?key=ABCDEFG"></script>
    <script type="text/javascript">
    google.load("maps", "2");
    google.setOnLoadCallback(function() {
        // Your logic goes here.
        // It will be run right after the maps module was loaded.
    });
    </script>
    

    For further details, see JSAPI's developer documentation.

    0 讨论(0)
提交回复
热议问题