title: Reference to immediate parent of a popup in javascript
body: <p>I am opening a popup in my web page using JavaScript. From the popup, I access an element in the parent page using <code>windows.parent.document.getElementsById("...")</code> and this gets me the required element, which I can then process.</p>
  
  <p>Now, there are couple of occasions when the web page is opened in another page using an IFrame. For this, the above JavaScript breaks, as windows.parent points to the outermost page (which contains the IFrame).</p>
  
  <p>Q: How do I get a reference to the immediate parent page of a popup in JavaScript, when the parent page is opened from another page via IFrames?</p>
  
  <p><strong>Edit</strong><br>
  What we are doing now is get the element using document.getElementsById("...") from the page calling the popup and then pass this value to the popup. Wanted to to know if there are any other elegant way to get the reference.</p>