473,698 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting HTML source code from IFrame

Hi everyone !

I'm really new to javascript, and am possibly aiming quite high
already, but still I feel I just satisfy my curiosity and ask you all
this question.

I've got this really really simple page which has an Iframe with
id="AAA" and a div section with id="BBB" . I've also got a link that
is points to void but onclick action fires a function.

What this function should do is make the Iframe load a specific page.
For that I use this code :

function firenow()
{
top.document.ge tElementById("A AA").src = "http://www.google.com/"
;
}

This is working fine.

Now the IFrame has an onload calling another function .... and what
this function should do it get all the source HTML (<html> <head>
,...... </head> .... </html> ) of the page being displayed on the
Iframe AAA and place that source code in the DIV BBB or inside a
variable if you would like.

Is this at all possible ?
Can anyone provide a really simple sample of how to do this ?
thanks a lot for your help

sh

Apr 13 '06 #1
1 2253
sy****@gmail.co m wrote:
top.document.ge tElementById("A AA").src = "http://www.google.com/"
Now the IFrame has an onload calling another function .... and what
this function should do it get all the source HTML (<html> <head>
,...... </head> .... </html> ) of the page being displayed on the
Iframe AAA and place that source code in the DIV BBB or inside a
variable if you would like.
Is this at all possible ?


No.
Security restrictions in browsers make this impossible unless both the
parent document and iframe document are in the same domain.
Otherwise, bad things would be possible.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Apr 13 '06 #2

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

Similar topics

6
14391
by: Wendi | last post by:
If i have an iframe from within an HMTL document: Iframe.htm: ------------------------------ <html> <head> <title>Iframe.htm</title> </head> <body> <iframe src="sample.htm"></iframe>
5
2562
by: Noorul Ameen | last post by:
Dear Folks, In a HTML page I want to get all the files in a selected dirs. Is that any way to do this thru javascript. Help will be highly appreciated. Thanks in advance. Regards, Ameen T
2
9926
by: Guoqi Zheng | last post by:
Dear sir, I am writting an WYSIWYG html editor, I need to get the html source code out of an iframe. I know I can use innerhtml or innertext. But that will remvoe the html header info which is what I need. html header may contains reference to base url or style sheet information. How can I get the full source code out of an iframe??? --
5
15811
by: David Elliott | last post by:
I need a control on a Web Page that can accept an HTML Document and will display it. Any help would be appreciated. Thanks, Dave Here is what I was trying...
9
11171
by: aatcbbtccctc | last post by:
Hi folks I've googled for an answer to this, with no success. Can someone please jump in, and put me out of my misery! (I'm sure it's quite simple) I have an invisible IFRAME, and a visible DIV: <IFRAME id=myframe style="display:none" src="..." onload="ShowNews(this)"></IFRAME>
4
2550
by: Drew | last post by:
This might beyond the scope of this group because it deals with SharePoint, but I'm not sure if I can't get it to work because of SharePoint or because JavaScript is weird (I don't have much experience with JavaScript). Anyway, here is the code i'm working with. Basically, it creates appends a hidden IFrame to the page, gets the links from the IFrame, and displays those which have the "OnLink" property. The weird thing is that when I...
12
11139
by: mistral | last post by:
Can anybody tell me how to get source code of page in iframe? (popup window is clickable image). When I right click on this popup border to view source, i see just as follows <html> <head> <title>New offer!</title> </head> <body style="margin-left: 0%; margin-right: 0%; margin-top: 0%;
3
4391
by: smartphreak | last post by:
not sure if this is the right forum but i will try explain myself. lets start by giving the code <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TITLE</title> <script type="text/javascript" src="loadiframes.js"></script> <style type="text/css"> body {
0
9160
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
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
8862
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...
1
6521
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
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...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.