title: onclick v no onclick; how to get the result without the click
body: <p>I have this code which sucessfully tracks the url as they change in the iframe:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;iframe src="start.php"&gt;&lt;/iframe&gt;
  &lt;a href="#" onclick="alert(frames[0].location);"&gt;Get Link.&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When 'Get Link' is clicked on it shows the right link. When the user navigates inside the iframe to another page (on the same server), and 'Get Link' is clicked again, it displays the current iframe url.</p>
  
  <p>But I need to get the iframe URL without having to 'click' something. </p>
  
  <p>When I do this:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;iframe src="start.php"&gt;&lt;/iframe&gt;
  &lt;script&gt;alert(frames[0].location)&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The alert message says "about:blank"</p>
  
  <p>How can I get the iframe location using  'frames[0].location'  passed into a variable that can be read by the parent page without having to use the onclick function?</p>