function getIframe() { const iframe = document.createElement("iframe"); iframe.setAttribute("src", "https://searchfox.org"); return iframe; } const container = document.getElementById("body"); const iframe = getIframe(); container.appendChild(iframe); container.appendChild(iframe.cloneNode(true)); // this one is blocked because of CSP container.appendChild(getIframe());