HTTP_REFERER isn't set using Explorer

16 views
Skip to first unread message

Benedict Verheyen

unread,
Jan 4, 2007, 4:29:32 AM1/4/07
to django...@googlegroups.com
Hi,

I have a table where i want the users to be able to edit
cells by clicking on them. Then they get the usual edit view
and after the changes are saved, they are redirected back
to the table view.
I use this in my template:
<td onclick="window.location='/patient/edit/{{patient.id}}/'">

It works for Firefox but unfortunately we use Explorer here
and Explorer doesn't work.
In the edit view i have a system where i keep track of the
referrer so i can redirect the user back to the correct page:
page = request.META["HTTP_REFERER"]
history[1] = history[0]
history[0] = page

This is what goes wrong in explorer: the HTTP_REFERER isn't set.
With Firefox, the HTTP_REFERER is set.

I tried to solve it by using a javascript function in the template
that explicitly sets the document.referrer.
The td code then looks like this:
onclick="edit({{patient.id}})">

The javascript function:
{% block extrahead %}
<script type="text/javascript">
// Only script specific to this form goes here.
// General-purpose routines are in a separate file.
function edit(id) {
document.referrer=window.location;
window.location='/patient/edit/id/'
};
</script>
{% endblock %}

Unfortunately, this doesn't work for both Firefox and Explorer.
In Firefox the clicking doesn't work, in Explorer, the click doesn't work
and gives an error. (runtime error on the
document.referrer=window.location; line)

Any idea how i can solve this?

Thanks,
Benedict

Julio Nobrega

unread,
Jan 4, 2007, 6:42:44 AM1/4/07
to django...@googlegroups.com
On 1/4/07, Benedict Verheyen <benedict...@gmail.com> wrote:
>
> Hi,

>
> This is what goes wrong in explorer: the HTTP_REFERER isn't set.
> With Firefox, the HTTP_REFERER is set.
>
> Any idea how i can solve this?

I had this problem with a client that was running Norton and
somewhere in the program preferences there's an option to disable the
browser referer. This is not exactly the name of the option, you'll
have to search for it. Maybe there's some application blocking,
specially if there's one installed that has privacy settings.

--
Julio Nobrega - http://www.inerciasensorial.com.br

ringemup

unread,
Jan 4, 2007, 7:30:46 AM1/4/07
to Django users
Julio's hit it on the nose. Not ot mention that Firefox actually has a
hidden setting for that too, and some proxies (including AOL's) also
block referrers. You might be best off explicitly passing the URL of
the current page as a parameter.

Benedict Verheyen

unread,
Jan 4, 2007, 10:20:42 AM1/4/07
to django...@googlegroups.com
ringemup schreef:

I still find it strange that only Explorer is affected and that Firefox
handles everything ok.
Anyway, i'll try and implement it as a parameter.

Thanks for the info,
Benedict

Reply all
Reply to author
Forward
0 new messages