CRM-17402: Defer loading Google Maps API
authorFrancis Whittle <francis@agileware.com.au>
Thu, 15 Oct 2015 00:00:32 +0000 (11:00 +1100)
committerAgielware Support <support@agileware.com.au>
Thu, 15 Oct 2015 00:03:48 +0000 (11:03 +1100)
----------------------------------------
* CRM-17402: Google Maps API sometimes tries to call initMap callback before it is defined.
  https://issues.civicrm.org/jira/browse/CRM-17402

templates/CRM/Contact/Form/Task/Map/Google.tpl

index 0605982b99c33bc9a73846eb8c71b4f077b8343b..348e8de18f7651244ffe96468f69f2f567c2ef00 100644 (file)
@@ -32,7 +32,7 @@
 {/if}
 {assign var=defaultZoom value=16}
 {literal}
-<script src="//maps.googleapis.com/maps/api/js?{/literal}{if $mapKey}key={$mapKey}{/if}{literal}&sensor=false&callback=initMap" type="text/javascript"></script>
+<script src="//maps.googleapis.com/maps/api/js?{/literal}{if $mapKey}key={$mapKey}{/if}{literal}&sensor=false&callback=initMap" type="text/javascript" defer="defer"></script>
 <script type="text/javascript">
     function initMap() {
         var latlng = new google.maps.LatLng({/literal}{$center.lat},{$center.lng}{literal});