监听浏览器返回上一页事件
// 监听返回上一页事件
"pushState" in window.history && (
window.history.pushState({
title: document.title,
url: location.href
}, document.title, location.href),
setTimeout(function () {
window.addEventListener("popstate", function (e) {
Modal.confirm({
title: '温馨提示',
content: '返回上一页您将退出个人客户OTC账户的业务办理!',
okText: "确认",
cancelText: "取消",
onOk:() => {
history.go(-1);
},
onCancel: () => {
this.cancel;
},
});
return false;
});
}, 1000)
);