Replicat the job of `webview`-s in an iframe!

Hello there! I’m trying to build a custom element that can load content just like webview-s.

class xView extends HTMLElement{
  constructor(){
    super();
    this.attachShadow({mode: 'open'});
    this.type = this.getAttribute("type");
    if(this.type == "web"){
      var iframe = document.createElement("iframe"), style = document.createElement("style");
      style.innerHTML = ":host { display: flex; }";
      iframe.setAttribute("style", "flex: 1 1 auto; width: 100%; border: 0px;");
      iframe.setAttribute("sandbox", "allow-forms allow-popups allow-scripts allow-same-origin");//allow-pointer-lock allow-top-navigation
      this.shadowRoot.appendChild(style);
      this.shadowRoot.appendChild(iframe);
      [...]
    }
    [...]
  }
}
customElements.define('x-view', xView);

I got the element to load content correctly. But I’m wondering, how can I preload content to the iframe just like the webview element?