0

我做了 30 多分钟的研究,但我无法弄清楚问题所在。我想防止用户在浏览器中回击并再次查看该页面。我该如何预防?我进行了大量研究并查看了我的银行发送的标题,但仍然无法弄清楚问题所在。

我必须支持 firefox,但让它在其他浏览器上工作也很好。

我发布的标题是(我通过查看我的浏览器认为的响应来确认)

Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: No-cache
Cache-Control: no-cache

在 html 我开​​始

<!DOCTYPE html>
<html>
<head>
    <title>The Title</title>
    <link href="/my.css" rel="stylesheet" type="text/css" />
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="EXPIRES" CONTENT="Thu, 01 Jan 1970 00:00:00 GMT">
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</head>

当我提交表单并回击时,我仍然可以看到该页面。我想让浏览器说文档过期/无效或重置所有 html,这样表单就没有用户数据了。我该怎么做呢?

4

1 回答 1

0

Have a look at History.js by Benjamin Lupton. You can register an event handler to the onstatechange event and then prevent the default action. We use the jQuery adapter and handle our own history records because of Ajax requests with a method like this.

History.Adapter.bind(window, 'statechange', function() {
    var HistoryState = History.getState();
    if (HistoryState) {

        var stateData = HistoryState.data;

        if (stateData) {


        }
    }
});

You should be able to use e.preventdefault and stop the user going back.

We add the state data object for each page in the data object with History.pushState(state, null, ''); but not sure if you need any data to stop them going back.

于 2013-01-27T23:45:42.777 回答