title: Google Maps with iframe doesn't work after page load
body: <p>My google map works fine on my site:</p>
  
  <pre><code>&lt;iframe id='iframe1' src="https://maps.google.com/maps?q=25.1954875,-111.6649204&amp;hl=fa;z=14&amp;ie=UTF8&amp;amp;output=embed&amp;hl=en"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>I should to change it, because of GTmetrix. So I decide to load it when page is loaded, here is my new code that doesn't load the map.</p>
  
  <pre><code> &lt;iframe id='iframe1' &gt;&lt;/iframe&gt;
  
      &lt;script&gt;
          window.addEventListener("load", function() {
              document.getElementById('iframe1').src = 'https://maps.google.com/maps?q=25.1954875,-111.6649204&amp;hl=fa;z=14&amp;ie=UTF8&amp;amp;output=embed&amp;hl=en';
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>Note: here is my problem with Gtmetrix, just sharing to complete my question:</p>
  
  <blockquote>
    <p>There are 5 static components without a far-future expiration date.   </p>
    
    <p><a href="https://maps.googleapis.com/maps/api/js?client=google-maps-embed&amp;paint_origin=&amp;libraries=geometry,search&amp;v=3.exp&amp;language=fa&amp;callback=onApiLoad" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/js?client=google-maps-embed&amp;paint_origin=&amp;libraries=geometry,search&amp;v=3.exp&amp;language=fa&amp;callback=onApiLoad</a>
        <a href="https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&amp;1i10787022&amp;2i6603899&amp;2e1&amp;3u16&amp;4m2&amp;1u543&amp;2u300&amp;5m5&amp;1e0&amp;5sfa&amp;6sus&amp;10b1&amp;12b1&amp;client=google-maps-embed&amp;token=64085" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage?1m2&amp;1i10787022&amp;2i6603899&amp;2e1&amp;3u16&amp;4m2&amp;1u543&amp;2u300&amp;5m5&amp;1e0&amp;5sfa&amp;6sus&amp;10b1&amp;12b1&amp;client=google-maps-embed&amp;token=64085</a>
        <a href="https://khms1.googleapis.com/kh?v=862&amp;hl=fa&amp;x=5267&amp;y=3224&amp;z=13" rel="nofollow noreferrer">https://khms1.googleapis.com/kh?v=862&amp;hl=fa&amp;x=5267&amp;y=3224&amp;z=13</a>
        <a href="https://maps.googleapis.com/maps/api/js/ViewportInfoService.GetViewportInfo?1m6&amp;1m2&amp;1d35.71592679292299&amp;2d51.45263317535978&amp;2m2&amp;1d35.73212757327154&amp;2d51.488170370963076&amp;2u16&amp;4sfa&amp;5e0&amp;6sm%40496000000&amp;7b0&amp;8e0&amp;11e289&amp;callback=_xdc_._ng5r7i&amp;client=google-maps-embed&amp;token=4563" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/js/ViewportInfoService.GetViewportInfo?1m6&amp;1m2&amp;1d35.71592679292299&amp;2d51.45263317535978&amp;2m2&amp;1d35.73212757327154&amp;2d51.488170370963076&amp;2u16&amp;4sfa&amp;5e0&amp;6sm%40496000000&amp;7b0&amp;8e0&amp;11e289&amp;callback=<em>xdc</em>._ng5r7i&amp;client=google-maps-embed&amp;token=4563</a>
        <a href="https://maps.googleapis.com/maps/api/js/ViewportInfoService.GetViewportInfo?1m6&amp;1m2&amp;1d35.71552264420163&amp;2d51.46028412421049&amp;2m2&amp;1d35.73193943495472&amp;2d51.48040793223049&amp;2u13&amp;4sfa&amp;5e2&amp;7b0&amp;8e0&amp;11e289&amp;callback=_xdc_._iyqfq0&amp;client=google-maps-embed&amp;token=32784" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/js/ViewportInfoService.GetViewportInfo?1m6&amp;1m2&amp;1d35.71552264420163&amp;2d51.46028412421049&amp;2m2&amp;1d35.73193943495472&amp;2d51.48040793223049&amp;2u13&amp;4sfa&amp;5e2&amp;7b0&amp;8e0&amp;11e289&amp;callback=<em>xdc</em>._iyqfq0&amp;client=google-maps-embed&amp;token=32784</a></p>
    
    <p>There is 1 redirect</p>
  
  <pre><code>https://maps.google.com/maps?... redirects to https://www.google.com/maps/embed?...
  </code></pre>
  </blockquote>