JS: Using document.referrer before page loads?

by Complex <complex_hwg(at)yahoo.com>

 Date:  Fri, 23 Feb 2001 12:35:36 -0800 (PST)
 To:  Languages HWG <hwg-languages(at)hwg.org>
  todo: View Thread, Original
I could swear I used to check the identity of document.referrer in the
head, before the page finished loading. However, when I just tried it,
I kept getting a JavaScript error.

I think the error came from trying to get document.referrer before the
page finished loading, but I dont' really know. However, everything
worked when I started using an onLoad handler to check
document.referrer after the page finished loading.

I'd prefer to do this check BEFORE the whole page loads. Can anyone
give me a clue?

This small script is in the head of my corporate site's downloads page:
http://www.scanalytics.com/product/download/index.html.
If you can't type that in directly, and get sent to the "Entry" page,
please just enter "Test(at)test.com" or somesuch as your email address to
get back to the interesting page.


(in head)
<script language="JavaScript" type="text/javascript">
	<!--
		function HoosierDaddy()
		{
			var From = document.referrer;
			var Good1 = "http://www.longURL.com/index.html";
			
			if (From != Good1)
				window.location = Good1;
		}
	//-->
</script>


Oh, yeah-- the other way to see this is to turn JavaScript off. :-) I'm
not terribly interested in pursuing that huge loophole....

complex

=====
Michael Greisman
Webmaster
Scanalytics, Inc.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA