0
역사를 밀고 변경 URL없이 데이터를 설정 :이유는 동일 같이 location.href (또는 빈)를 밀어 때 window.onpopstate 빈에 event.state입니다
window.history.pushState({
stateName: "myStateName",
randomData: window.Math.random()
}, "myStateName", location.href);
.... 다음을 듣고
{
stateName: "myStateName",
randomData: 0.34234234234
}
:
window.onpopstate = function(event) {
console.log(event.state); //logs null
}
하는 당신은 대부분의 시간을이 상태 값 대신에 null를 얻을 것이다 : 팝업 이벤트 및 브라우저에서 뒤로 버튼을 눌러서 트리거
어떻게 해결할 수 있습니까? 왜 이런 일이 발생합니까?