Forum Moderators: coopster & phranque

Message Too Old, No Replies

Pass http referrer information

From cgi to html

         

JimThomason

6:30 pm on Dec 16, 2002 (gmt 0)

10+ Year Member


I have for example
http://mydomain.com/code1.cgi
http://mydomain.com/code2.cgi

After some processing of other things these are redirects
print "Location: http://mydomain.com\n\n";

On the index page I am wanting to use javascript that uses document.referrer to know which of these scripts redirected the visitor to the index page but redirects from these scripts pass no referrer information.

Is there a way to have it pass the referrer information to the index.html page?

Is there another method I can use other than document.referrer so the javascript knows which script redirected the visitor?

jatar_k

6:43 pm on Dec 16, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You could use a get string to tell the index page which script it was. I imagine that they are redirected after performing some task so search engines wouldn't be an issue.

Key_Master

7:05 pm on Dec 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Assuming you're using Perl, you can replace the location header in your script with the following. It will admend the script name to the URL. Then you need to figure out a way to extract the script name from the address.

print "Location: http: //mydomain.com/?$ENV{'SCRIPT_NAME'}\n\n";

Instead of being redirected to http: //mydomain.com, you get redirected to http: //mydomain.com/?code1.cgi which should still take you to the index page.

JimThomason

9:07 pm on Dec 16, 2002 (gmt 0)

10+ Year Member


Thanks jatar_k and Key_Master for your quick replies.

I figured it out shortly after posting. I just changed my redirect to
print "Location: http://mydomain.com/mypage.html?Value\n\n";

And then used the get string solution jatar_k suggested.

Thank you both very much,

Jim