Iframe content loading process

2019-07-23 07:11发布

Having following code

<iframe id="myframe" src="..."></iframe>

<script>
document.getElementById('myframe').onload = function() {
  alert('myframe is loaded');
};
</script>

i wonder how does the browser processes an iframes? Does it load the iframe content in the separate thread? If so is it run synchronously with the main thread?

标签: html iframe
2条回答
聊天终结者
2楼-- · 2019-07-23 07:24

That depends stronly to the browser. Internet Explorer for example starts a seperated thread for each tab you open, some might do that otherwise. Actually, some browsers support specially secured threads for frames: https://www.chromium.org/developers/design-documents/oop-iframes

So, which browser are you asking for especially?

查看更多
可以哭但决不认输i
3楼-- · 2019-07-23 07:42

The iframe is loading sync with the main website. If you want to load the content of the main site first

<body onload="javascript:...">
查看更多
登录 后发表回答