Click to See Complete Forum and Search --> : location.href in frames


tjuni
02-18-2003, 02:30 PM
I have a page with two frames. Within the script of the first frame, I am trying to access the location.href of the second frame. My code is:

alert(parent.document.frames("FFF").location.href);

This code does NOT work and I'm very frustrated. I've tried all kinds of different possiblities and I just can't seem to get a handle on the location.href property of the frame - even from the parent page.

Can anyone help, please?

gil davis
02-18-2003, 02:51 PM
Instead of:alert(parent.document.frames("FFF").location.href);it should be

alert(parent.document.frames["FFF"].location.href);

assuming the pages are in the same domain. If they are not, then you will not get any answer regardless of your syntax.

tjuni
02-18-2003, 03:06 PM
Thanks Gil. Actually, I believe the parentheses work in IE - the browser that I'm working with. My problem is that the frames are not from the same domain & protocol. Is there any way for me to access the location of the second frame despite this? I really need to get its querystring value.

Taibe

gil davis
02-18-2003, 04:27 PM
No. Security protocols will not allow JavaScript to cross domains.