473,325 Members | 2,860 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,325 software developers and data experts.

Source code and frames


Is it possible for one frame to capture the source code of an
adjoining frame in the same window?
Aug 4 '05 #1
1 1617


Mike wrote:
Is it possible for one frame to capture the source code of an
adjoining frame in the same window?


Well IE's DOM has the outerHTML property which is not the original
source code however but a serialization of the current DOM. So you could try
var frame = parent.frames.otherFrameName;
if (frame && frame.document && frame.document.documentElement) {
var currentSource = frame.document.documentElement.outerHTML;
}
For Mozilla or other browsers not implementing outerHTML you would need
to write your own DOM serializer code (or search the web for people
already having implemented outerHTML for Mozilla).

If you want the original source code then some options exist too:
- IE/Win has the download behavior to download text files
from the server
- IE/Win with MSXML and Mozilla, Opera 8 and others with
XMLHttpRequest can be used to make a HTTP GET request to load from a URL
and the responseText property might return the source text then (barring
encoding issues that is)

Whatever you try the same origin policy only allows access to (frames
from) the original server.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 4 '05 #2

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

Similar topics

5
by: Pete Wason | last post by:
Hiall! I have a demo viewer page for javascript stuff that has three buttons "DEMO" "HTML" and "JSCR", and an IFRAME called 'viewer'. Initially, the IFRAME gets loaded with the actual demo...
2
by: Sergio del Amo | last post by:
Hi, I wrote some functionality for a Web Page with Javascript. My code works perfectly for Firefox but not for IE. I become some errors apparently all based in the same problem wich scapes to my...
2
by: Simon | last post by:
Hello, A frameset contains 3 html pages: page A, page B and page C. I need to get the HTML source of page B. I tried to use AxWebBrowser to do that, but failed. Do you have any idea? Thanks,...
1
by: Yuki | last post by:
hi all ! I need a help... I have a html page, with a frameset in it... in the "banner", I have some buttons inside a repeater control.. when I click any button, I need to change the source of the...
12
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>...
3
by: bulldog8 | last post by:
I am having problems with changing a frames source file for Mozilla (1.5.0.4). The followig code works for IE: <script type="text/javascript"> var imgP = new Image(); function...
2
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
4
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.