jQuery
브라우저 뒤로가기 버튼 막기
Developer Garam.Choi
2017. 5. 29. 22:13
$(document).ready(function() {
var checkPage = null;
if (document.referrer) {
checkPage = true;
}
if(checkPage){
history.pushState(null, null, location.href);
window.onpopstate = function(event) {
if (confirm("정말 이동하시겠습니까?") == true){ //확인
history.back();
}else{ //취소
history.pushState(null, null, history.go(2));
return;
}
}
}
});