Thread View: borland.public.cppbuilder.internet.web
9 messages
9 total messages
Started by Gordon Dooley
Thu, 24 Feb 2005 10:46
TWebResponse and Frames problem
Author: 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>
Re: TWebResponse and Frames problem
Author: Hans Galema
Date: Thu, 24 Feb 2005 11:23
Date: Thu, 24 Feb 2005 11:23
11 lines
1351 bytes
1351 bytes
Gordon Dooley wrote: > 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. Is that file loaded by the broser from the clientcomputerharddisk or requested from the webserver ? Hans.
Re: TWebResponse and Frames problem
Author: Gordon Dooley
Date: Thu, 24 Feb 2005 12:20
Date: Thu, 24 Feb 2005 12:20
22 lines
1613 bytes
1613 bytes
Loaded from the hard disk everything works fine. Served up from TWebResponse everything works except access to some other Frame properties Thanks Gordon "Hans Galema" <notused@notused.nl> wrote in message news:421db98f$1@newsgroups.borland.com... > Gordon Dooley wrote: > > > 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. > > Is that file loaded by the broser from the clientcomputerharddisk > or requested from the webserver ? > > Hans.
Re: TWebResponse and Frames problem
Author: Hans Galema
Date: Thu, 24 Feb 2005 13:18
Date: Thu, 24 Feb 2005 13:18
16 lines
1639 bytes
1639 bytes
Gordon Dooley wrote: > Loaded from the hard disk everything works fine. Served up from TWebResponse > everything works except access to some other Frame properties Sorry. You did not understand the question. There are three scenarios: - the browser requests the webserver for a page that will be produced by TWebResponse - the browser loads a html page from the clients hd. - the browser requests the webserver for a (the same)htmlpage upon which the webserver sends that file. ( so without using your exe.) Please try the third option. Hans.
Re: TWebResponse and Frames problem
Author: Gordon Dooley
Date: Thu, 24 Feb 2005 13:46
Date: Thu, 24 Feb 2005 13:46
35 lines
2330 bytes
2330 bytes
Hi, Thank you for being patient and thanks for your help. I have tried your scenario 3: that is, I have put the test HTML on the web server then loaded it with http://servername/path/test.htm. Everything works as expected and correctly. As an additional test, I have tried loading that same file as text in the TWebResponse function and returning that in response to the request, and the error returns. It appears that it is only scenario 1 that causes the problem. Gordon "Hans Galema" <notused@notused.nl> wrote in message news:421dd483$1@newsgroups.borland.com... > Gordon Dooley wrote: > > Loaded from the hard disk everything works fine. Served up from TWebResponse > > everything works except access to some other Frame properties > > Sorry. You did not understand the question. There are three scenarios: > > - the browser requests the webserver for a page that will > be produced by TWebResponse > - the browser loads a html page from the clients hd. > - the browser requests the webserver for a (the same)htmlpage > upon which the webserver sends that file. ( so without > using your exe.) > > Please try the third option. > > Hans.
Re: TWebResponse and Frames problem
Author: Hans Galema
Date: Thu, 24 Feb 2005 13:54
Date: Thu, 24 Feb 2005 13:54
12 lines
1617 bytes
1617 bytes
Gordon Dooley wrote: > It appears that it is only scenario 1 that causes the problem. You could write a separate app using TIdHTTP or TNMHTTP to get both the static page from the webserver and the one produced by TWebResponse. Then compare the headers. The exampleproject that comes with builder for TNMHTTP can do that. So you could immediately use it. Hans.
Re: TWebResponse and Frames problem
Author: Gordon Dooley
Date: Thu, 24 Feb 2005 14:19
Date: Thu, 24 Feb 2005 14:19
21 lines
1678 bytes
1678 bytes
Thanks. I will try what you suggest and get back to you. Kind regards Gordon "Hans Galema" <notused@notused.nl> wrote in message news:421ddcf7$1@newsgroups.borland.com... > Gordon Dooley wrote: > > > It appears that it is only scenario 1 that causes the problem. > > You could write a separate app using TIdHTTP or TNMHTTP > to get both the static page from the webserver and the one > produced by TWebResponse. Then compare the headers. > > The exampleproject that comes with builder for TNMHTTP can do > that. So you could immediately use it. > > Hans.
Re: TWebResponse and Frames problem
Author: Gordon Dooley
Date: Thu, 24 Feb 2005 15:09
Date: Thu, 24 Feb 2005 15:09
65 lines
3064 bytes
3064 bytes
Hi Hans OK. The headers that I get returned are below. I have tried adding the missing headers but still get the same problem. However, in playing around with the links, I find that if I refer to the remote file with a relative path (i.e. href="test4.htm") then everything works fine, whereas if I refer to it with an absolute path (i.e. href=http://machine/path/test4.htm) I get the same problem. This is also true for the cgi I am calling. This is now starting to look like it is not a Borland problem but more likely a Microsoft problem. I have solved the problem by converting all my links to relative links and everything is working fine. I am still interested in an explanation if you or anyone else can give one, but since the immediate problem is solved I would not wish anyone to waste time on my behalf. Thank you for your help in this - I have learnt a lot and while the solution was not directly related to your suggestions, I doubt that I would have got there without them Cheers Gordon *************** From TWebResponse *************** HTTP/1.1 200 OK Server: Microsoft-IIS/5.1 Date: Thu, 24 Feb 2005 14:27:52 GMT Content-Type: text/html Title: Test Content-Length: 44739 Content: *************** From direct call *************** HTTP/1.1 200 OK Server: Microsoft-IIS/5.1 Date: Thu, 24 Feb 2005 14:31:20 GMT Content-Type: text/html Accept-Ranges: bytes Last-Modified: Thu, 24 Feb 2005 13:38:12 GMT ETag: "0ba8d15761ac51:a81" Content-Length: 44739 "Hans Galema" <notused@notused.nl> wrote in message news:421ddcf7$1@newsgroups.borland.com... > Gordon Dooley wrote: > > > It appears that it is only scenario 1 that causes the problem. > > You could write a separate app using TIdHTTP or TNMHTTP > to get both the static page from the webserver and the one > produced by TWebResponse. Then compare the headers. > > The exampleproject that comes with builder for TNMHTTP can do > that. So you could immediately use it. > > Hans.
Re: TWebResponse and Frames problem
Author: Hans Galema
Date: Thu, 24 Feb 2005 15:18
Date: Thu, 24 Feb 2005 15:18
10 lines
1584 bytes
1584 bytes
Gordon Dooley wrote: > This is now > starting to look like it is not a Borland problem but more likely a > Microsoft problem. You mean the webserver or the browser ? If browser is IE then test with FireFox too. Hans.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads