'How would you link a custom iframe?

I am wanting to link an iframe that is untitled, and I have gotten some code that lets me create an iframe, I just cannot figure out how to link the iframe. My code just lets me open the iframes, and I cannot figure out how I could modify my code to make it linkable, and I have seen this done before, but I was wondering if anyone could help me. (I do use it as a bookmarklet as well)

Javascript:

(function() {
  var win = window.open();
  var f = win.document.createElement("iframe");
  window.focus();
  var url = win.prompt("enter url", "https://");
  if (!url) return;
  win.document.body = win.document.createElement("body");
  f.style.width = "100vw";
  f.style.height = "100vh";
  win.document.body.appendChild(f);
  f.src = url
})()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source