Iframe is slow to load, and it will take three or four seconds to load it out.

1, there is an iframe, in the page a. What the iframe page does is a svg line animation.

2, the problem encountered now:
after testing, iframe always waits for the content in page a to be loaded before loading. The result is that when page an is opened for the first time, the animation of that svg is displayed blank before it is loaded, and the animation comes out after refreshing the page.

whether you write down the src attribute of iframe directly or add it with js, the effect is the same.

3. There is no obvious change in the loading speed after all the contents of svg animation are removed. It is considered that it is not the problem of svg animation

.

4. So consider loading iframe first. Is there anything you can do about it?
or how can I optimize the loading speed of iframe?

Mar.23,2021

you can let iframe load when a page loads:

window.onload=function () {
mainFrame.src= "xx.html";

Menu