473,788 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.d ocument 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:

clientInformati on,clipboardDat a,closed,defaul tStatus,documen t,event
,external,frame s,history,Image ,length,locatio n,name,navigato r
,offscreenBuffe ring,onafterpri nt,onbeforeprin t,onbeforeunloa d,onblur
,onerror,onfocu s,onhelp,onload ,onresize,onscr oll,onunload,op ener,Option
,parent,screen, screenLeft,scre enTop,self,stat us,top,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 5962
"Jeff Thies" <cy*******@spri ntmail.com> wrote in message
news:3F******** *******@sprintm ail.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
getElementsByTa gName('iframe') and it may have one of the
'contentWindow' or 'contentDocumen t' (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
9802
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 ---------------------------------------------------------------------------- -------------------------------------------- Here's how the site works: You should press a button in the rollover area in order to load a source file on an Iframe, this Iframe is actually hidden working as a Buffer. The body of this loaded Iframe is...
3
8133
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 title. I am trying to change the title of the IFrame window to be that of the contained window title. If I uncomment the alert statement below - the title change works. Comment out the alert - and - no title change.
3
7371
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 something like the below but I just can't get it to work. any ideas? Ta F
14
18292
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
4488
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 includes background music with a javascript music player on the main page below an iframe that is used for all content and navigation of the site and so that the music doesn't reload each time a page is switched. There is another javascript to resize...
1
3058
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 they will co-operate if there are small things they need to do in their code, like putting something in the body tag or adding some script, though I would ideally like everything to be done in this page, and not in their pages). ...
9
8846
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 contained in our page. All we need to do is to READ the location.href of that iframe (which is again, from anohter domain, not our domain) - but we can't! According to this MSDN article, http://msdn.microsoft.com/en-us/library/ms533028(VS.85).aspx...
23
6633
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 use it? IE5 or IE6? Thanks
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10113
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.