Forum Moderators: open

Message Too Old, No Replies

How to get URL of frame page

         

anusha1

4:52 am on Mar 23, 2005 (gmt 0)

10+ Year Member



Hi all

In my page, there are 2 frames. Second fram contain an externel url (eg. www.google.com). I want to get second frame's url from top fram. I used "parent.bottom.URL" but it returns "Undefined". Please help

Fram Main Page

<html>
<head>
<title>New Page 2</title>
</head>
<frameset rows="*,*">
<frame name="top" src="new_page_3.htm">
<frame name="bottom" src="http://www.google.com">
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>

Fram Top Page (new_page_3.htm)

Code:
<html>
<head>
<title>New Page 3</title>
<script>
function showURL()
{
alert(parent.bottom.URL)
}
</script>
</head>

<body>
<form>
<input type="button" onclick="showURL()" value="Show URL">
</form></body>
</html>

SpaceFrog

8:29 am on Mar 23, 2005 (gmt 0)

10+ Year Member



try not using reserve words af javascript languages as names and or variables ...

avoid bottom as a name!

anusha1

4:25 am on Mar 28, 2005 (gmt 0)

10+ Year Member



Hi,
Thanks for replying. Even though I changed "bottom", I got the same error msg. Please help.

Regards

Anusha

rocknbil

6:15 pm on Mar 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think that's going to be allowed and is by design. You can't get any info on a neighboring frame if the source file is an external site URL.

If this were allowed, advertisers in framesets could sniff the next frame and see what data is being put in it, or even replace that frame with their ads. As long as the pages loaded in the frames are from the same server you should be able to manipulate those documents, just not external ones.