I have embedded a page in a `<iframe>` as follows :

```
<iframe id = 'iframeid'
        src="/qgis/index.html"
        scrolling="no"
        frameborder="0"
        style="height: 100vh;
               width: 100%"
        onload="on_load(this)">
</iframe>

```

And here is the on\_load function called once the iframe is loaded.

```
<script type="text/javascript">

function on_load(iframe) {
try {
  var lat = -0.017;
  var lng = 0.015;
  var zoom = 16;

  var map = document.getElementById("iframeid").contentWindow.map;

  map.setView([lat, lng], zoom);
  } catch (e) {
    // This can happen if the src of the iframe is
    // on another domain
    alert('exception: ' + e);
  }
}
</script>

```

My problem is that the `<iframe>` enters a loop and the page is loaded once again, inside the `<iframe>`, and it goes like this indefinitely.

[![enter image description here](https://i.stack.imgur.com/i55Gm.png)](https://i.stack.imgur.com/i55Gm.png)