Article View: comp.lang.javascript
Article #214Problem: Frames, Mac and NN
From: Russ Moore
Date: Sat, 27 Feb 1999 00:00
Date: Sat, 27 Feb 1999 00:00
114 lines
4902 bytes
4902 bytes
Much appreciation and deep gratitude to any hints towards solving this
problem.
I've modified some code to allow the re-direction of a standard reply
from an ISP provided CGI form program and replacement with personal
confirmation or failure pages. It uses a typical hidden frame approach.
The frameset page holds the JavaScript and the visible frame has the
form page and the hidden frame is preloaded with a dummy page with the
title 'Blank Title' (original huh :} ) When the form is submitted the
JavaScript , see below, compares the title of the document in the hidden
frame until it changes from the preset. When this happens it checks for
a number of known features of the standard reply and then redirects to
the user's confirm or failure page, destroying the frameset as it does
so.
It works on a PC with both IE3 IE4 and NN 4.06, and on the Mac with IE4.
It even degrades with Lynx and is not even a total disaster with WebTv.
However with NN 4.08 on the Mac it just refuses to behave. It
consistently just goes straight to the failure page after the form is
submitted.
I think I can safely rule out a frame not having finished loading. The
re-load bug caused by META tags is unlikely as this would occur across
all browsers not just the one. As all pages are created in the same
domain there shouldn't be any security problem. Which seems to leave
pure b.. mindedness; or do you now different.
Russ
CODE EXTRACT
var blankTitle = "Blank Frame";
var FileSent = false;
function formHandler()
{
clearTimeout(timerID); // Clear timer
// place marker for validation routine
WaitForReply(); // Wait for reply from www server
if(demo || FileSent)
{
FileSent = true;
return( false);
}
else
{
FileSent = true;
return( true);
}
}
// Wait for a reply from Demon. Check for reply once per second.
// Load the users confirm page if the Demon reply is okay.
// Otherwise load a page indicating a failed form submission.
//
function WaitForReply()
{
if (ReplyReceived())
{
if (FormSubmitted())
{
// Loads your custom form confirm page,telling
it where to return
// replaces this document so to removes the
framset created by the loader
self.location.href = ConfirmPage + '?' +
CallingPage;
}
else
{
// Load your custom form failure page with same
info
self.location.href = FailurePage + '?' +
CallingPage;
}
}
else
{
timerID = self.setTimeout("WaitForReply()",1000);
}
}
// Returns true if frame 'receive' contains a page other than
blankFrame.
// This occurs when Demon mailform script sends a reply.
// The reply may be a confirmation page or an error message.
//
function ReplyReceived()
{
return (window.receive.document.title != blankTitle);
}
// Returns true if 'receive' contains the Demon mailform confirmation
page.
//
function FormSubmitted()
{
var CorrectTitle = (window.receive.document.title ==
ReplyTitle);
if (demo)
{
var CorrectPath = true;
var CorrectHost = true;
}
else
{
var CorrectPath = (window.receive.location.pathname ==
ReplyPath);
var CorrectHost = (window.receive.location.hostname ==
ReplyHost);
}
return (CorrectTitle && CorrectPath && CorrectHost);
}
-- ----------------------------------------------------------------------------
|< mailto:RussM@verge.demon.co.uk > Live NOW and pay later |
|< http://www.verge.demon.co.uk/index.htm Life's too short to take seriously |
-------------------------------------------------------------------------------
Technical Details
Message-ID:
<4wNFGJASgA22EwUj@verge.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa2f2,f2e84ecaa4b55545,start X-Google-Attributes: gidfa2f2,public X-Google-Thread: f76f2,f2e84ecaa4b55545,start X-Google-Attributes: gidf76f2,public X-Google-Thread: fb3cb,f2e84ecaa4b55545,start X-Google-Attributes: gidfb3cb,public From: Russ Moore <postmaster@nospam.demon.co.uk> Subject: Problem: Frames, Mac and NN Date: 1999/02/27 Message-ID: <4wNFGJASgA22EwUj@verge.demon.co.uk> X-Deja-AN: 449293306 X-NNTP-Posting-Host: verge.demon.co.uk:158.152.91.232 X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 920126375 nnrp-13:28177 NO-IDENT verge.demon.co.uk:158.152.91.232 Organization: V.E.R.G.E. MIME-Version: 1.0 Reply-To: Russ Moore <WebMaster@verge.demon.co.uk> Newsgroups: comp.lang.javascript,comp.infosystems.www.browsers.mac,demon.homepages.authoring