On Jun 29, 2011, at 1:18 PM, Richard Arts wrote:
>
> Can somebody point out to me how to use the request.env.http_referrer
> to link to the previous page?
>
> So far I have tried the following in the template file:
> {{=A('Back', _href=URL(request.env.http_referrer))}}
> but it links to the current page.
>
> Trying to supply the http_referrer through a dict does not work either.
>
> I'm certain I must be overlooking something...
>
> Using 1.97.1.
It's not your problem, but it's 'http_referer'; it got misspelled somewhere
back in the mists of Internet time.
It's an absolute URL, so URL() won't do anything useful with it. You'll need
something more like _href=request.env.http_referer.
Alternatively, you can parse it and pull out the bits that you need to pass to
URL() (assuming that the referring page is in your app).
Generally speaking, I think you're better off tracking the referral chain
internally, rather than relying on http_referer.