Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I ran into this issue today - you just need to load the API asynchronously. This isn't so much a workaround as a documented alternative, which you can read up on here:</p> <p><a href="https://developers.google.com/maps/documentation/javascript/tutorial#asynch" rel="nofollow">https://developers.google.com/maps/documentation/javascript/tutorial#asynch</a></p> <p>Essentially you just need to change any code like this:</p> <pre><code>&lt;script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&amp;sensor=SET_TO_TRUE_OR_FALSE" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function initialize() { var map = new google.maps.Map(/* ... */); } window.onload = initialize(); &lt;/script&gt; </code></pre> <p>To this (lifted almost entirely from the link above):</p> <pre><code>&lt;script type="text/javascript"&gt; function initialize() { var map = new google.maps.Map(/* ... */); } function loadScript() { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&amp;sensor=TRUE_OR_FALSE&amp;callback=initialize"; document.body.appendChild(script); } window.onload = loadScript; &lt;/script&gt; </code></pre> <p>The key thing to note here is that you have to pass a <strong>callback</strong> parameter to the script.src tag (in this example we provide <strong>initialize</strong>, but it can be whatever you want) - this will let google fire your initialisation code when the dynamically injected maps script tag has finished loading.</p> <p>This second mechanism fixes my Zombie tests.</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