Access container of parent iframe element (Iframe inside iframe)
dom, html, iframe, javascript
Solution
Maybe this:
var outer = window.parent;
var mainWindow = outer.parent;
var container = mainWindow.document.getElementsByClassName('container')[0];
but dont forget that your iframes have to be on the same domain.
Problem
I have next structure of elements: ``` <div class="container"> <iframe class="outer"> .. <iframe class="inner"> actual markup with scripts here </iframe> </iframe> </div> ``` using pure javascript, i've meneged to get out of "inner" iframe into outer one: ``` //this is HTML tag of ".outer" iframe var parent = window.parent.document.getElementsByTagName('html')[0]; ``` but still i need to get to ".container" element in order to manipulate it. Can anyone tell me how to get ".container" element from script inside ".inner" element??