title: Access parent URL from iframe
body: <p>Okay, I have a page on and on this page I have an iframe.  What I need to do is on the iframe page, find out what the URL of the main page is. </p>
  
  <p>I have searched around and I know that this is not possible if my iframe page is on a different domain, as that is cross-site scripting. But everywhere I've read says that if the iframe page is on the same domain as the parent page, it should work if I do for instance:</p>
  
  <pre><code>parent.document.location
  </code></pre>
  
  
  
  <pre><code>parent.window.document.location
  </code></pre>
  
  
  
  <pre><code>parent.window.location
  </code></pre>
  
  
  
  <pre><code>parent.document.location.href
  </code></pre>
  
  <p>... or other similar combos, as there seems to be multiple ways to get the same info. </p>
  
  <p>Anyways, so here's the problem.  My iframe is on the same domain as the main page, but it is not on the same SUB domain.  So for instance I have</p>
  
  <blockquote>
    <p>http:// www.mysite.com/pageA.html</p>
  </blockquote>
  
  <p>and then my iframe URL is </p>
  
  <blockquote>
    <p>http:// qa-www.mysite.com/pageB.html</p>
  </blockquote>
  
  <p>When I try to grab the URL from <code>pageB.html</code> (the iframe page), I keep getting the same access denied error.  So it appears that even sub-domains count as cross-site scripting, is that correct, or am I doing something wrong?</p>