Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing an iFrame's dom from a Firefox Extension
    primarykey
    data
    text
    <p>I've spent a long time trying different things to get this to work but nothing does and documentation is not helping much.</p> <p>I'm trying to populate a form inside an iframe that I dynamically inject into a page. To inject that iframe I do:</p> <pre><code>myObject.iframe = document.createElement("iframe"); myObject.iframe.setAttribute("src", data.url); myObject.iframe.setAttribute("id","extension-iframe"); myObject.window.document.getElementById('publisher').appendChild(myObject.iframe); myObject.iframe.addEventListener("load", function(){ myObject.populate(data); }, false); </code></pre> <p>which works fine and DOES trigger the populate() method. My problem is getting the document or window objects for that iframe. I've tried all of the following:</p> <pre><code>myObject.iframe.window myObject.iframe.document myObject.iframe.content </code></pre> <p>but these are all undefined.</p> <p>I also tried passing the event object to that iframe's load event listener and then doing:</p> <pre><code>event.originalTarget </code></pre> <p>But that didn't work either.</p> <p>I am reading the following documentation:</p> <ul> <li><a href="https://developer.mozilla.org/En/Working_with_windows_in_chrome_code" rel="nofollow noreferrer">https://developer.mozilla.org/En/Working_with_windows_in_chrome_code</a></li> <li><a href="https://developer.mozilla.org/en/Code_snippets/Interaction_between_privileged_and_non-privileged_pages" rel="nofollow noreferrer">https://developer.mozilla.org/en/Code_snippets/Interaction_between_privileged_and_non-privileged_pages</a></li> </ul> <p>But either I'm not understanding it or it's just not properly explained.</p> <p>Can anyone shed some light?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload