Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested IFrames in IE - cant get to parent document 1

Status
Not open for further replies.
Jun 24, 2005
109
GB
Hi all,

I've done quite a bit of work with javascript in a Sharepoint environment and am trying to achieve something that I have done before, it just seems this time the exact same method isn't working!

My basic problem is in trying to refer to a parent frame's document. I've tried window.parent and window.top but the only thing I can do is refer back the iframe I'm calling from.

Its really strange, when I'm calling window.top.frames.length its telling me there's 7 frames, but will only give me any joy when I refer to frame 4 (which is the one I'm running my javascript from).

Any ideas. What I really want to do is window.top.document.getElement....etc.

Cheers

Matt
 
the [tt]top.document[/tt] should give you your parent frame's document.

if you're in a frame within a frame you will need to reference top twice. the "window" before the top is not needed.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
yeah I tried that but it still doest work, the error message in IE is Access Denied. I didn't even realise you could deny access in this type of scenario?
 
You're attempting to access frames that contain pages from domains other than the one your code comes from?

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Webflo
 
The document I'm trying to access has several iframes on it, and 1 or 2 of them are sourced from a different domain. I'm not trying to access those frames, just the parent frames document.

Essentially the iframe my code is in has some div tags wrapping it that are restricting its size. I'm trying to use javascript to amend the sizes on the divs.

Cheers
 
Why not put the code in the document which the IFRAME is in? Or just set the sizes on the IFRAMES to something more appropriate?

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Webflo
 
Its a sharepoint site which is made of a master template and several web parts. I'm trying to make the web part self contained and also resize itself dynamically. Unfortunately the size of the part is normally managed by the template.

The tempate cannot be amended, and the content of the part I'm creating changes each time the page is loaded. so whilst I could set the web part size statically, I wanted to allocate it when the page loads.

Does this make sense?
 
Sorry guys, my mistake, the web part is from a different domain to the rest of the site. Does this cause a big problem?
 
Yup

If the browsers allowed that sort of business you could send a user a link with their internet banking site wrapped in a frame, with some script in the containing page to grab the username and login details and post them back to you.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Webflo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top