开发者

local copy of this webpage is out of date

开发者 https://www.devze.com 2022-12-20 22:40 出处:网络
My Web pages causes following error on the browser\'s Back Button, It works fine for firefox but not on IE,

My Web pages causes following error on the browser's Back Button, It works fine for firefox but not on IE,

IE Says,

Most likely cause: •The local copy of this webpage is out of date, and the website requires that you download it again.

What you can try: Click on the Refresh button on the toolbar to reload the page. After refreshing, you might need to navigat开发者_运维知识库e to the specific webpage again, or re-enter information.

what should be the cause ?

I'm using Django + mod_python + apache as production environment.

how can I eliminate this error or how to trace any help would be appreciated.


Using GET instead of POST isn't always possible, e.g. when the amount of data exceed the maximum URL length. So, if you want to use POST i would suggest, that you response with a redirect after each POST. Something like that (pseudocode):

def view(request):
   form = Form(request.form)
   if request.method == 'POST' and form.validates():
       # process form data, e.g.
       m = Model(form.data)
       m.save()
       # response with a redirect (e.g. to the newly inserted data, or
       # back to the initial page)
       return redirect(m.get_absolute_url())
   return render_template('template.html', form=form)

The advantage of this is that the user won't get those annoying warnings about resending any POST data you described and that multiple submissions of the same data are less likely to occur (which means for example fewer double postings).


You're not wrong in your suggestion. It's because you've used a POST on that page. If you want people to go back to the page, put a link on the page to take them back to where they want to go, but make sure that they can still view the page properly without having to POST data to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号