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/