[Django]-Perform an action and redirecting to the same URL doesn't refresh the page

5👍

What happens is, the browser asks for the new URL and via 302 gets redirected back to the previous one, which is in the cache and thus not refreshed. Adding a random integer, like Piotr is suggesting will solve the problem. For randomness you can use simple timestamp.

Implication of performing forward as you are doing makes your app unRESTful and prohibits user bookmarking the results – i wonder if it is really what you would like to do.

It might be worth a try to try and use 303 or 307 status code instead of 302, maybe that behaves differently.

See also:
http://en.wikipedia.org/wiki/HTTP_302

http://en.wikipedia.org/wiki/Representational_State_Transfer

👤tm_lv

1👍

I’d say you’re doing it wrong. The same URL should be the same page. Everything with HTTP and web browsers assume this, and when you don’t follow this convention you’re going to get yourself into trouble. Just add the search parameters and sort orders as query parameters to the URL.

👤Teddy

0👍

How about redirecting to

http://website.fr/search/?ignoredvar=<random int>

Please provide the full http conversation If you need a better solution.
The conversation can be traced using firebug or live http headers.

Btw. The above solution is the only one I know for similar bug in a flash on IE.

Leave a comment