title: Spoof navigator inside <iframe>
body: <p>I am writing a browser extension for privacy. One of the things I need to do is spoof the window.navigator object and it's properties which I have managed to do successfully for the main window object. I need to also spoof the window.navigator object for each iframe.contentWindow on the page. I suppose I could use self.frames and then loop through that spoofing each  but what about frames that are created after my code runs but that don't exist when my code runs e.g. var myFrame = document.createElement("iframe"); ???</p>
  
  <p>I want all navigator object instances the one in the main window as well as the one created in each iframe to be spoofed. To give you an idea of what I am trying to do, this does not work to spoof the navigator inside each iframe.</p>
  
  <pre><code>Object.defineProperty(HTMLIFrameElement.prototype.contentWindow, "navigator", {
    configurable: true,
    enumerable: true,
    value: "some fake navigator object"
  });
  </code></pre>
  
  <p>Maybe because its actually window.HTMLIFrameElement.prototype and thats where I'm going wrong?</p>
  
  <p>Any ideas?
  If you don't understand the question please ask for more detail.</p>