none
Access IFRAME from console in F12 Developer Tools RRS feed

  • Question

  • My web page has an iframe in it...

    How do I access content in it from the Console of the F12 Developer Tools?  All commands seem to run in the context of the top window, and I cannot find a way to interact with the content of the iframe.

    (IE11 on Windows 7)

    Friday, January 17, 2014 7:53 PM

Answers

  • Hi,

    its buggy....the find tool on the Find tab of the developer tool is supposed to select the Root node of the contentWindow... Depending on xss restrictions and if the iframe has a sandbox attribute and/or the IE Security zone that the top and iframe windows map to.

    You must use the http(s) protocol (do not test using the file: protocol).

    the window object has a frames collection.

    type window.frames in the console tab

    or

    dir(frames[n])

    to display its DOM tree.

    Post questions about html, css and scripting for website development to the IE Web Development forum, with a link to your website or publicly accessible mashup. If you are running html using the file protocol (or custom protocol handler)... say so in your question.


    Rob^_^

    • Marked as answer by Glen Little Saturday, January 18, 2014 6:58 AM
    Saturday, January 18, 2014 12:42 AM

All replies

  • Hi,

    its buggy....the find tool on the Find tab of the developer tool is supposed to select the Root node of the contentWindow... Depending on xss restrictions and if the iframe has a sandbox attribute and/or the IE Security zone that the top and iframe windows map to.

    You must use the http(s) protocol (do not test using the file: protocol).

    the window object has a frames collection.

    type window.frames in the console tab

    or

    dir(frames[n])

    to display its DOM tree.

    Post questions about html, css and scripting for website development to the IE Web Development forum, with a link to your website or publicly accessible mashup. If you are running html using the file protocol (or custom protocol handler)... say so in your question.


    Rob^_^

    • Marked as answer by Glen Little Saturday, January 18, 2014 6:58 AM
    Saturday, January 18, 2014 12:42 AM
  • Thanks.

    It looks like I can access the global variables in the iframe with:

       >  window.frames[2].variableName

    Not quite as nice as just typing  'variableName'  but it will do.

    Saturday, January 18, 2014 6:58 AM