473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

iframe reading problems

I'm (still) having trouble reading the contents of an IFRAME (IE5).

I have this:
var my_iframe = document.frames['my_iframe'];

What I would want to do at that point is get either the
contentWindow.document or the contentDocument depending on whether this
was IE or Mozilla. (Thanks Lasse.)

I'm not finding this.

if I iterate through the properties:
var c='';
for (var prop in my_iframe){
c+='property:'+prop+"\n";
for(var item2 in my_frame.prop){
c+=' item2 '+item2;
}
}
alert(c);

I don't see the needed properties and none of the properties I do see
have any properties themselves.

Here are the properties I do see:

clientInformation,clipboardData,closed,defaultStat us,document,event
,external,frames,history,Image,length,location,nam e,navigator
,offscreenBuffering,onafterprint,onbeforeprint,onb eforeunload,onblur
,onerror,onfocus,onhelp,onload,onresize,onscroll,o nunload,opener,Option
,parent,screen,screenLeft,screenTop,self,status,to p,window

Is this an IE5.0 limitation (I use the "least common denominator"
browsers to test, and you can't load two IE versions on windows)?

Or have I done something else wrong?

Jeff
Jul 20 '05 #1
1 5934
"Jeff Thies" <cy*******@sprintmail.com> wrote in message
news:3F***************@sprintmail.com...
I'm (still) having trouble reading the contents of an IFRAME (IE5).

I have this:
var my_iframe = document.frames['my_iframe'];

What I would want to do at that point is get either the
contentWindow.document or the contentDocument depending
on whether this was IE or Mozilla. (Thanks Lasse.)

I'm not finding this.

if I iterate through the properties:
<snip>
I don't see the needed properties and none of the
properties I do see have any properties themselves.

Here are the properties I do see: <snip> Is this an IE5.0 limitation (I use the "least common denominator"
browsers to test, and you can't load two IE versions on windows)?

Or have I done something else wrong?


Assuming that the contents of the IFRAME do not originate in another
domain and so have not been rendered inaccessible by security
restrictions, there are two sides to an IFRAME. The IFRAME _element_ in
the DOM of the current page. You can get at that with
getElementsByTagName('iframe') and it may have one of the
'contentWindow' or 'contentDocument' (also look at its DOCUMENT,
Document & document properties on IE 5.0 but try the others first to
avoid confusion on Opera). The IFRAME is also represented as a normal
(usually; doesn't work like this on iceBrowser 5) frame in the
window.frames collection. The frame will have an index in the frames
collection, If it has an ID it may also appear as a named property of
the frames collection but the widest support for exposing an IFRAME as a
named property of the frames collection is to give the IFRAME element a
NAME attribute.

The object referenced by - document.frames['my_iframe']; - should be the
global object (window) for the page displayed within the IFRAME, so its
document property is the document within the IFRAME.

My JavaScript DOM Listings (see signature) include an IFRAME and could
show you the difference between accessing an IFRAME as an element on the
page and as a member of the frames collection.

Richard.
--

Example JavaScript DOM listings for: Opera 7.11,
Mozilla 1.2 and ICEbrowser 5.4
<URL: http://www.litotes.demon.co.uk/dom_root.html >
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Javier | last post by:
Hello, I'm very new in this forum and as I have the following problem, the website is in http://new.vanara.com ----------------------------------------------------------------------------...
3
by: Russell | last post by:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull. I have a modal dialog that is an IFrame. The IFrame contains another window - which contains the appropriate...
3
by: foldface | last post by:
Hi Completely ignore the non-standard nature of the noddy example below. I want to capture a mouse click in a frame from outside that frame. Everything I read online seems to indicate its...
14
by: Aaron Gray | last post by:
Hi, I want to access the properties of an IFrame but seem unable to get access to the IFrames document body. <html> <body> <iframe src="test.html" id="IFrame"></iframe> </body>
3
by: PCgeek | last post by:
sorry moved this over to javascript forum, didn't mean to post 2x! Hi guys, I'm trying to put the finishing touches on my website and could really use some help on this particular issue. My page...
1
by: knkk | last post by:
Hi, I have an iframe that fetches content from a different domain. This is my URL, which has an iframe that fetches content from another site careerbuilder.co.in (this is a partnership channel, so...
9
by: Lee | last post by:
Hi all, We need to create a page where we detect the finish of a game that's hosted on another site. We thought of doing it with frames, where we would put the game in an iframe that is...
23
by: vunet | last post by:
It is recommended by some sources I found to create IFrames in IE using document.createElement('<iframe src="#">') instead of document.createElement('iframe'). Why and what browser versions to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.