Article View: borland.public.cppbuilder.internet.web
Article #1356TWebResponse and Frames problem
From: Gordon Dooley
Date: Thu, 24 Feb 2005 10:46
Date: Thu, 24 Feb 2005 10:46
49 lines
2493 bytes
2493 bytes
Hi,
I have been struggling with this one for a while and can't find a
resolution., can anyone help?
I have a CGI web server app built with C++Builder5. I am outputting the
results of the TWebResponse to one of two FRAMEs. Everything works fine and
the Javascript in the output can correctly access its parent frame, but when
I try to access properties of other frames it simply dumps out of the
Javascript. In the example below, test1() correctly displays the name of the
current frame and the count of frames (2), but dumps out thereafter. The
reason I think this is a TWebResponse problem is that I can load exactly the
same HTML directly from a file into the frame and everything works
perfectly.
I am returning the HTML with:
...
Response->ContentType = "text/html";
Response->Content = text; // generated from a file and variables
...
I should stress, everything at the superficial level is working fine, it is
ONLY when I try to access properties of other frames that I get the error.
Is this a loading problem or something like that?
Thanks in advance
Gordon Dooley
The HTML returned by TWebResponse is:
*************************************
<HTML>
<HEAD>
<script language="JavaScript">
function test1() {
alert("Me: " + name);
alert("Parent frame count: " + parent.frames.length);
alert("Sibling name: " + parent.frames[0].name); // and other
reference to parent also fails
};
</script>
<TITLE>Package Listing</TITLE>
</HEAD>
<BODY onload="test1();"> // fails if called from a button also
</BODY>
</HTML>
Technical Details
Message-ID:
<421db012$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!feeder1.cambrium.nl!feed.tweaknews.nl!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: feeec,fe7d95cb9ff32958,start X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Gordon Dooley" <gdooley@nospam.update.co.uk> Newsgroups: borland.public.cppbuilder.internet.web Subject: TWebResponse and Frames problem Date: Thu, 24 Feb 2005 10:46:40 -0000 Lines: 51 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 213.2.50.226 Message-ID: <421db012$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109241874 213.2.50.226 (24 Feb 2005 02:44:34 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!feeder1.cambrium.nl!feed.tweaknews.nl!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail