I seek to have iframes load on the page after the rest of the page has loaded, for performance. Tried the following script
function createIframe(){
var i1 = document.createElement("iframe");
i1.src = "https://www.desmos.com/calculator/wqprgorphr?embed";
i1.scrolling = "auto";
i1.frameborder = "0";
i1.width = "300px";
i1.height = "300px";
i1.style.border = "1px solid #ccc"
document.getElementById("ifr1").appendChild(i1);
};
if (window.addEventListener){
window.addEventListener("load", createIframe, false);}
else if (window.attachEvent){
window.attachEvent("onload", createIframe);}
else {window.onload = createIframe;}
<div id="ifr1"></div>
- doesn't seem to work; the iframes still begin loading while equations on page are rendering. See full code for a demonstration: https://jsfiddle.net/r6bxgem3/115/ (view in 'bottom results' setting).
Any working alternatives? Help is appreciated.
(This does not work)
` tag will result in the browser waiting until the page loads then calling the javascript function. If this is not the case then I am clearly misunderstanding the question.
– Cory Kleiser Aug 31 '18 at 01:17