<p></p>
<p>I find maps are loading correctly in Chrome when I use the <a href="https://leafletjs.com/" rel="nofollow">Leaflet JavaScript Library</a> but not when I use an iframe.</p>
<p>Because my websites are responsive (Flexbox CSS), I am only using the iframe's 'src' attribute with URL obtained via OpenStreetMap's 'Share' button. However I do not think this is affecting the issue.</p>
<p>I too think the issue may be caused by a timing or "race condition". This has led me to trying this code which I find shows the correct map:</p>
<pre><code><iframe id="map1" class="Box_Map" src=""></iframe>
<script>document.getElementById("map1").src="https://www.openstreetmap.org/export/embed.html?bbox=0.09304046630859376%2C52.14381308981805%2C0.6663894653320314%2C52.32925493016711&amp;layer=mapnik"</script>
</code></pre>
<p><em>Note: my class "Box_Map" styles the iframe instead of attributes from the 'Share' button embed code.</em></p>
<p>If this is a timing issue, I cannot guarantee this solution will work on a very fast PC. An alternative approach would be to put the script in another file and embed it using the HTML '<a href="https://www.w3schools.com/tags/att_script_defer.asp" rel="nofollow">defer</a>' attribute.</p>
<p>It is evident that the query string portion of the URL (bbox=......) is telling the OpenStreetMap server what area of the world the map should cover. So if the URL (with bbox query string) is obtained with a map displayed in a large browser window, at least the same area of the world will be displayed when displayed within a relatively small iframe. To do this, I expect JavaScript code within the web page from OpenStreetMap is getting the iframe's dimensions (in pixels) using window.clientWidth and window.clientHeight. This is where I guess there is a timing bug in Chrome.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/2531#issuecomment-801064788">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNBILNSQKMKOQIV7IDTECSIRANCNFSM4KTV6P6Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLIOKWIQD22GAPUBUUDTECSIRA5CNFSM4KTV6P62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOF67UOVA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/2531#issuecomment-801064788",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/2531#issuecomment-801064788",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>