Why are iframes so slow?

前端 未结 3 1480
我在风中等你
我在风中等你 2021-01-31 17:36

I have little bit longer question for you - but hope answer will be very simple :)

Let\'s say I have very simple page with link and iframe (just for simple example).

3条回答
  •  长发绾君心
    2021-01-31 17:46

    You are pretty much on the right track. iframes are going to be slower because there is an additional overhead for the browser (rendering it, maintaining it's instance and references to it).

    The ajax call is going to be a bit faster because you get the data in and you then inject it, or do whatever you want with it. The iframe will need to build an entirely new "page" in the browsers memory, and then place it in the page.

提交回复
热议问题