Discuss access url of imbedded frame page? in the JavaScript Development forum on Dev Shed. access url of imbedded frame page? JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
Posts: 7
Time spent in forums: 57 m 40 sec
Reputation Power: 0
access url of imbedded frame page?
I have an iframe which contains two further frames. One of those frames changes. Is there a way, through javascript or any other method, that i can tell from the top level which page has been loaded? I tried location.href, but can only get the url of the frameset that is the iframe, not the pages loaded below it. Any ideas?
I'm trying to write a function from the mainpage, that tells me what page is loaded into the display frame. I believe the problem is that the iframe is considered an object rather than a frame, so i cant access the frames below it.
Right now I have something that looks like
Code:
<script language="javascript">
<!--
function get_url() {
var frame_url = frames['gallery'].location.href;
return frame_url;
}
-->
</script>
But this only gives me the url of "galleryframes.html" and I can't get it to work with any frame below that.
Posts: 19,893
Time spent in forums: 6 Months 2 Days 19 h 21 m 49 sec
Reputation Power: 4192
You almost had it.
You forgot the double slashes in from of the end of the HTML comment.
The language attribute of the script element is deprecated in favor of the type attribute.
Also, there wasn't any reason to make a new variable just so you could return it.
Posts: 7
Time spent in forums: 57 m 40 sec
Reputation Power: 0
Thanks for your help.. Unfortunately it doesnt work. I get the error, 'frames.gallery.frames.display.location' is null or is not an object. Here is my page...