mkahn has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I found a node 140177 on referring urls, reccomending a $ENV referrer call. This only linked me back to my cgi-bin, not to the script, much less the full data-encrusted URL. This later case is what I'm shooting for.

<a href=\"$ENV{'HTTP_REFERER'} \">
This is right up perls alley, right? Also, if a (6 month old) node grows in the forest, will anyone be there to read it?

Thanks in Advance,
Mark
(first nonymous post, confessed modphobe)

Thanks to everyone who answered my AM post about abs paths for dirtests.

Replies are listed 'Best First'.
Re: Back Button (referring URL\?)
by dws (Chancellor) on Jun 14, 2002 at 19:38 UTC
    HTTP_REFERER isn't reliable. Some proxies strip it. And if you do manage to get an HTTP_REFERER, you'll want to examine it before using it, since redirecting someone to a Google search isn't the same as using the browser's Back button to back into a cached result page

      Thanks for the response. The page I'm trying to link back to is also on my site. Maybe my isp strips that, I don't know. Do I need to use jscript? Also, why don't I see this thread on seekers?
        I was guessing that what you were trying to do was create a link back to the previous page (the page that "referred" you to the current page). $ENV{HTTP_REFERER} isn't reliable for this in general, due to some proxies and some older browsers. But it sounds from your original post as though you're using a CGI to create pages. So I'm unclear on what, exactly, you're trying to do. Are you trying to create a link back to the page from outside of your side that originally referred a session to your site? Or to some static page on your site?

Re: Back Button (referring URL\?)
by ckohl1 (Hermit) on Jun 15, 2002 at 02:08 UTC
    You could store the state of the web pages in a form or URL variable. Then use that form or URL variable in the pages that follow to build a "back" button/link. This example:
    href="myscript2.cgi?ref_page=myscript1.cgi&ref_action=get_fractals"
    shows the link that could be used to get from web page one, to web page two. Once at web page two, the CGI can look backwards by parsing the ref_page and ref_action variables. This could be used to move the user one page back.


    Chris