Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current Target of an iframe

Status
Not open for further replies.

irate

Programmer
Jan 29, 2001
92
0
0
GB
I have a page with an iframe, and a button.
When you click the button I want it to capture the CURRENT location of the iframe.
If I use the iframe.src it will return the INITIAL location.
Does anyone know how I can get the current URL of the iframe.

Note: I have also tried
Code:
document.getwebpage.location.href
which gave me a permission denied error?

code:
Code:
<html>
 <head>
  <title>Target Page Selector</title>
 </head>
 <body>
  <center>
   <table width=&quot;100%&quot; height=&quot;100%&quot;>
    <tr>
     <td>Navigate to the page you want and click the select button</td>
    </tr>
    <tr>
     <td align=&quot;center&quot;>
      <iframe width=&quot;640&quot; height=&quot;450&quot; src=&quot;[URL unfurl="true"]http://www.google.com/&quot;[/URL] name=&quot;getwebpage&quot; id=&quot;getwebpage&quot;></iframe>
    </td>
   </tr>
   <tr>
    <td align=&quot;center&quot;>
     <input type=&quot;button&quot; value=&quot;select&quot; onclick=&quot;alert('url = ' + document.all.getwebpage.src)&quot;>
    </td>
   </tr>
  </table>
  </center>
 </body>
</html>
 
Just like you would with a regular frame or window... using the location.href property.

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life--};
 

I don't think you can because the page is on a separate domain.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top