在做CRUD操作的页面上,如果用户操作后点击回退会导致数据错误,想到用js禁用浏览器的回退功能。
//禁用页面回退功能,防止用户页面回退,导致信息错误
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
});
在做CRUD操作的页面上,如果用户操作后点击回退会导致数据错误,想到用js禁用浏览器的回退功能。
//禁用页面回退功能,防止用户页面回退,导致信息错误
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
});