我希望用户不能单击弹出的确认弹出窗口。怎么做?当我单击“后退”按钮(浏览器)时发生弹出窗口
if (window.history && history.pushState) {
addEventListener('load', function () {
history.pushState(null, null, null);
addEventListener('popstate', function () {
var stayOnPage = confirm("Are you sure? Mission will be failed");
if (!stayOnPage) {
history.pushState(null, null, null);
} else {
window.location = 'google.com';
}
});
});
}