Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Prevent HTTP_REFERER variable from being cached?
Ok, I might sound totally clueless here but I’m trying to explain: on the site I’m currently developing, one can reach a single entry view from two different entry points (sections). On the single view I have to put a “back to overview” link that takes the user back to whereever he came from.
What I did was the following:
<a href="<txp:php>$url = parse_url($_SERVER['HTTP_REFERER']);echo $url['path'];</txp:php>">Back to overview</a>
That worked really well but as soon as I switched into Live-Mode, the HTTP_REFERER variable was somehow cached. And that of course, broke the functionality. (Turning “Send last modified headers” off made it work again but the page is less snappy.)
So is there any way to do this but still benefit from some caching?
The current workaround is using javascript:history.back()
…
Offline
Re: Prevent HTTP_REFERER variable from being cached?
sthmtc wrote:
That worked really well but as soon as I switched into Live-Mode, the HTTP_REFERER variable was somehow cached.
I think it wasn’t only the HTTP_REFERER variable which was cached serverside but the whole page – on the client side. Which is the sole purpose of switching “Send last modified headers” to on…
Any chance that you could add a dynamic part to the common page’s URL on the referring pages, like so:
<a href="/the/detailpage?<txp:php>echo time();</txp:php>">go to detail page</a>
which would add the current time to the target URL and thus force reloads with every elapsed second,
or this, with a little less effect on snappiness:
<a href="/the/detailpage?<txp:page_url />">go to detail page</a>
Offline