title: How to pass the value to the Text field of Extension Window? (Firefox WebExtension)
body: <p>I'm trying to write my first WebExtension for Firefox 60.0.1 Quantum, and ask for your help.</p>
  
  <p>I'm try to briefly describe my Firefox WebExtension.</p>
  
  <ul>
  <li><p>Step 1. In the browser panel, press the extention button, - opens my
  Extension Window.</p></li>
  <li><p>Step 2. In this Extention Window there is a HTML-Page (file<br>
  window.html) with a text field called "Active Tab URL" (id="url").</p></li>
  <li><p>Step 3. When switching/updating Tabs in main browser window, this<br>
  text field should contain URL of the Active/Opened Tab.</p></li>
  </ul>
  
  <p>My Questions:</p>
  
  <ol>
  <li>How can I pass (from background.js) a any value to the text field (id="url") of my Extension Window?</li>
  <li>How can I get the URL of the active Tab, to transfer it to my Extension Window?</li>
  </ol>
  
  <p>I searched the information on the site: <a href="https://developer.mozilla.org/en-US/Add-ons/WebExtensions" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/Add-ons/WebExtensions</a>
  but unfortunately I did not understand how it can be done.</p>
  
  <p>Thank you for your help and ideas!</p>
  
  <hr>
  
  <h2><strong>manifest.json</strong></h2>
  
  <pre><code>{
  
    "description": "Adds browser action icon to toolbar to open packaged web page.",
    "manifest_version": 2,
    "name": "Extension Window",
    "version": "1.0",
    "permissions": ["tabs", "contextMenus", "clipboardWrite", "clipboardRead"],
    "icons": {"48": "icons/icon-48.png"},
  
    "background": {
      "scripts": ["background.js"]
    },
  
    "browser_action": {
      "default_icon": "icons/icon-32.png"
    }
  
  }
  </code></pre>
  
  <hr>
  
  <h2><strong>background.js</strong></h2>
  
  <pre><code>function openMyWindow() {
  
      var createWindow = {
      type: "detached_panel",
      url: "window.html",
      titlePreface: "Extension Window",
      width: 350,
      height: 950
      };
  
  
      let windowId;
  
      browser.windows.create(createWindow).then((data) =&gt; {
      windowId = data.id;});    
  
  /*
  1. How can I pass a any value to the text field (id="url") of my Extension Window?
  2. How can I get the URL of the active Tab, to transfer it to my Extension Window?
  */  
  
  
  }
  
  
  /*
  Add openMyWindow() as a listener to clicks on the browser action.
  */
  browser.browserAction.onClicked.addListener(openMyWindow);
  </code></pre>
  
  <hr>
  
  <h2><strong>window.html</strong></h2>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Extension Window&lt;/title&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;/head&gt;
  &lt;body&gt;  
  
  &lt;h1&gt;My Extention Window&lt;/h1&gt;
  &lt;p&gt;Active Tab URL: &lt;input id="url" type="text"&gt;&lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>