Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
169
rated 0 times [  170] [ 1]  / answers: 1 / hits: 68721  / 12 Years ago, wed, august 22, 2012, 12:00:00

this is the code im using.............



i want to get current url(href) from below code ...............



<html>
<head>
<script type=text/javascript>
function load() {
var url = document.getElementById(iframeid);

//get the ifram onload url of href
//(i.e) http://www.image.com/home.html

}
</script>
</head>
<body>
<iframe onload=load() name=Google id=iframeid scrolling=auto style=width:95%;height:600px src=http://www.image.com >

</iframe>
</body>
</html>

More From » javascript

 Answers
31

This will work only if they are in the same domain,protocol and port:



document.getElementById(iframe_id).contentWindow.location.href


else use :



document.getElementById(iframe_id).src

[#83489] Tuesday, August 21, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kourtney

Total Points: 368
Total Questions: 103
Total Answers: 85

Location: Bonaire
Member since Sat, May 1, 2021
3 Years ago
kourtney questions
Sun, Oct 4, 20, 00:00, 4 Years ago
Tue, Oct 29, 19, 00:00, 5 Years ago
Thu, Apr 4, 19, 00:00, 5 Years ago
Fri, Mar 1, 19, 00:00, 5 Years ago
;