PDA

View Full Version : Fetch URL from iFrame?



LMS16
20-10-2010, 07:56 AM
Hi,
I'm abit stuck...
I want to be able to fetch a url from an iframe, I'm assuming you will need to use javascript?

Example:
Iframe points to "http://facebook.com?jkjfh" I want to be able to fetch that url from the iframe if possible...

+REP for any help.

Lew.

Delatory
20-10-2010, 12:11 PM
<script type="text/javascript">
function grabURL(){
var iframe = document.getElementById('frame');
alert(iframe.src);
}
</script>

<input type="button" onclick="grabURL()" value="Grab URL"><br />
<iframe src="http://google.com" id="frame"></iframe>

Want to hide these adverts? Register an account for free!