473,394 Members | 1,750 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,394 software developers and data experts.

inspecting the iframe

Is it possible for javascript to inspect the contents of an iframe or
is it an external object?

<iframe id="myiframe" src="">

<script>
document.getElementById.myiframe.src =
"http://www.wherever.com/foo.php"
</script>

I can set the src of the iframe from javascript, can I read the
results, assuming the iframe returns some text?

like with frames you can nest the document object,
mytext = document.getElementById.myiframe.document.body

Herc

Jul 23 '05 #1
2 1916
he*****@hotmail.com wrote:
Is it possible for javascript to inspect the contents
of an iframe or is it an external object?
So long as cross-domain security restrictions don't apply, it is
possible to access the window object within an IFRAME through the -
frames - collection of the containing window object.
<iframe id="myiframe" src="">
However, of you want to access IFRMAE content through the - frames -
collection as a named property of the collection you would be better off
giving the IFRAME an additional name attribute that correspo0nds with
its ID.
<script>
Valid HTML 4 requires SCRIPT elements to have a TYPE attribute.
document.getElementById.myiframe.src =
It is extremely unlikely that the function object that is the
getElementById method of the document will have a property named
'myiframe'. You should be calling the getelementById method at this
point an passing the ID of the element to it as a string.
http://www.wherever.com/foo.php
By W3C HTML DOM standard assigning a value to the - src - property of an
IFRAME is a meaningless and pointless activity (i.e. cannot be expected
to provide useful or consistent results across DOM standard browsers
(and doesn't)). Navigating IFRAMEs is best done by assigning to the -
location - property of their correspo0nding window object.
</script>

I can set the src of the iframe from javascript,
But you probably shouldn't expect that to do anything useful.
can I read the
results, assuming the iframe returns some text?

like with frames you can nest the document object,
mytext = document.getElementById.myiframe.document.body


frames['myiframe'].document.body

- assuming you give the IFRAME a NAME attribute of "myiframe".

Richard.
Jul 23 '05 #2
This is how I was running a basic shoutbox

document.getElementById("if1").src =
"http://www.ch3ss.com/test/chat.php?say=" + document.chat.say.value

chat.php just adds the say.value to a text file and echoes the file.
(its offline now incase people send it junk).

I can't seem to get frames["myiframe"}.document.body to return
anything, Access is denied, I tried changing permissions.

Herc

Jul 23 '05 #3

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

Similar topics

2
by: Csaba2000 | last post by:
I want to be able to embed a single quote into an INPUT element within a dynamically generated IFRAME. The example below shows how the IFRAME is generated. Challenge: I'd like the alert box to...
4
by: Thomas | last post by:
Hi there, I have an iframe which is editable (designMode = "on") and want to resize it dynamically as the content grows (e.g. more lines of text is in there) and there the struggle starts. I...
2
by: Templar | last post by:
Hi i'm bothering with such problem... I must dynamic create an Iframe, and then put som raw HTML into it. But I can't. When I create iframe, I can't access its properties. Here's the coe...
1
by: Martin | last post by:
There seems to be some strange behaviour when trying to get the scrollHeight and scrollTop of an iframe in IE6. I have tried several ways of getting these values when the iframe is written into...
7
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+...
3
by: Angel | last post by:
How do I get the reference of the IFrame from the asp.net webpage that is being displayed within that IFrame? In other words I have an IFrame in my page. Within that IFrame Set the source to a...
1
by: jaktharkhan | last post by:
Hi, I really really need help in trying to figure out how can I do a CloneNode on an Iframe where the cloned IFRAME clones with all its contents?. Basically what I am doing is dynamically building...
0
by: tequilamala | last post by:
I have an Iframe in one of the pages i am developing... the iframe is suppose to scroll up and down and the links target the iframe. the problem is that the iframe scrolls side to side on internet...
1
by: Z1P2 | last post by:
I would like to gradually resize an iframe in an onmouseover event. I can easily do it with an image, but when I try to do it with an iframe, it doesn't do anything. So first of all, is it possible...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.