Basic Script Question

Hello:

This one is very simple I'm sure for more advanced JS coders...

I have a page where a user fills out a simple form and is taken to a standard, ISP-generated thank-you page. This page does not rediredt them or anything, so they use the "Back" button to return to the original form page.

However, when they come back, I would like to display different text on the page. I thought I could do it like this:

<SCRIPT LANGUAGE="JavaScript">
<!--
var from = document.referrer;

if (from == 'http://home.interlynx.net/cgi-bin/fastmail.pl')
{
self.document.writeln('<body>');
self.document.writeln('<h1><a NAME="top">Purchase Verification</a></h1>');
self.document.writeln('<hr>');
//etc., etc.
}
else
{
self.document.writeln('<body>');
self.document.writeln('<h1><a NAME="top">Purchase Verification</a></h1>');
self.document.writeln('<hr>');
//etc., etc.
}
//-->
</SCRIPT>

But this script doesn't seem to work properly because the back button is being used?? I am sure that I just need to change my "from' variable to get it to work.

TIA for any helpdocument.referrer wont work since you do not navigate through a link.

I don't know if it works, because I did not test it so it may just be wishfull thinking, but you could try:

if (window.history.next) {
document.write("Thank You");
}

You may get a security (permission) error, however.
Try it, and see if it works.

KennethKenneth:

Thanks for your help. Before coming back and seeing your reply, I did do some playing around with trying to use the history just like you suggest, but ran into the permission errors you refer to.

I'll keep poking away.Hi, I don't understand what is ment by "standard, ISP-generated thank-you page". can you post the url to it? and are you able to edit it?
Thanks.Hi:

I can't really post the URL, as it is a PERL script...but if you fill out this simple form on our web site, you'll see it when you hit the "Submit" button.

<!-- m --><a class="postlink" href="http://www.envirosim.com/forms/wlist.htm">http://www.envirosim.com/forms/wlist.htm</a><!-- m -->

Thanks,
Chris ByeIan...I see that you haven't tried out the form at the URL I gave you the other day in order to see the "Thank You" page I referred to...

Don't worry about just putting junk in the form as the results get emailed to me.

Cheers,
Chris ByeMoving this post to the server side forum.
 
Top