Gossamer Forum
Home : General : Perl Programming :

You can't solve this! (netscape problem)

Quote Reply
You can't solve this! (netscape problem)
Hello

------perl code--------
$ref="$ENV{'HTTP_REFERER'}";
print qq(
document.write('hello:$ref');
-----------------------
called with:

<script language="JavaScript" src="any.cgi"></script>

It works with IE but Netscape prints only
-------
hello:
-------
It does not send the referer!
:(
Ideas?

Quote Reply
Re: You can't solve this! (netscape problem) In reply to
I can't tell you for sure why it doesn’t work but I think it has to do with the way (and when) Netscape interprets the JS. You can work around it like this though:

[perl code]
#!/usr/bin/perl

$ref="$ENV{'HTTP_REFERER'}";
print "Content-type: text/html\n\n";
print "Hello: $ref";


Then call your cgi via SSI:

<!--#exec cqi="/cgi-bin/test.cqi" -->

(change the q's to g's)

~CP

Quote Reply
Re: You can't solve this! (netscape problem) In reply to
I'm calling the file remotely. Can't use SSI :(

Quote Reply
Re: You can't solve this! (netscape problem) In reply to
How about using the JS referrer?

<script language="JavaScript" type="text/javascript">
<!--
document.write("Hello: " + document.referrer);
//-->
</script>


Quote Reply
Re: You can't solve this! (netscape problem) In reply to
You are missing the proper operators around the javascript codes:

The codes should be:

Code:

$ref="$ENV{'HTTP_REFERER'}";
print qq(document.write('hello:$ref'););


And also, make sure you are using:

Code:

<SCRIPT SRC="http://www.yourdomain.com/cgibin/something.cgi"></SCRIPT>


If you are missing the closing SCRIPT tag in the SCRIPT anchor, then it most likely will error out.

Regards,

Eliot Lee
Quote Reply
Re: You can't solve this! (netscape problem) In reply to
It seems that Netscape is not getting the referer... so there are no methods to make it print the HTTP_REFERER (it is NULL).

I believed that 'document.referer' in js could work... but even this has NOT produced a result. Netscape is getting the referer only if the page is reached through a 'link'.

Other suggestions are welcome ;)

Thank you.

Quote Reply
Re: You can't solve this! (netscape problem) In reply to
In Reply To:
Netscape is getting the referer only if the page is reached through a 'link'.
That is how the referer environmental variable works...you cannot simply type in the location of the page in the Address/Location bar in your web browser and get a "referer". You have to come from a "link" in order for the value to show.

Regards,

Eliot Lee
Quote Reply
Re: You can't solve this! (netscape problem) In reply to
You get it with IE or the latest version of Opera.... when you call a remote script through iframe or javascript ;)