window.history.back()显示“文档已过期”页面,任何方式? [英] window.history.back() shows "Document Expired" page, any way around that?

查看:792
本文介绍了window.history.back()显示“文档已过期”页面,任何方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户端要求用户点击结果后返回到搜索结果完整的页面。现在这是一个简单的jQuery调用:

Client is asking for the ability for users to go back to a page full of search results after clicking on a result. Right now it's a simple jQuery call:

$('a.detail-back-button').on('click', function(evt) {
    evt.preventDefault();
    window.history.back();
});

然而,这显示了Firefox中的文档过期页面。我知道这是安全的,但客户端希望这样实现。我已经做了一些搜索,我已经找到一个PHP解决方案的问题...

This shows a "Document Expired" page in Firefox, however. I know it's there for security, but the client wants this implemented anyways. I've done some searching around and I've found a php solution to the problem...

session_cache_limiter('private_no_expire')

...但这是一个基于Django的网站。有没有其他解决方案?

...but this is a Django-based web site. Are there any other solutions?

更新02/21/13

下面的解决方案只适用于不是IE的浏览器。 IE8 / 9/10似乎没有重新请求上一页。有没有一个IE解决方法?

The solution below works but only for browsers that aren't IE. IE8/9/10 doesn't seem to re-request the previous page. Is there an IE workaround?

推荐答案

这与定义非必需性的 POST ed请求。即一个 POST 是一个具有效果的动作,因此不重要。为了防止这种情况偶然发生,一些浏览器会在重新提交原始表单之前显示一个带有确认消息的占位符页面。

This has to do with the by definition non-idempotent nature of POSTed requests. I.e. a POST is an action which has an effect, and is thus unsafe to repeat. To prevent this from happening accidentally, some browsers show a placeholder page with a confirmation message before resubmitting the original form.

最可靠的解决方案 - 可能是唯一的一个 - 请使用 GET 方法提交您的表单,这是有道理的。

The most reliable solution -possibly the only one- is to submit your form using the GET method instead, which makes sense anyway.

这篇关于window.history.back()显示“文档已过期”页面,任何方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆