当前页面点击返回后返回上级页面,再次点击上级页面返回无效窗口。onload=()=>{history.pushState("tmp",null,null);window.onpopstate=()=>{history.pushState('new',null,null);};}检测用户触发浏览器返回window.onpopstate=(event)=>{console.log(event.state);alert("兄弟,你点击了返回");};

当前页面点击返回后返回上级页面,再次点击上级页面返回无效窗口。onload=()=>{history.pushState("tmp",null,null);window.onpopstate=()=>{history.pushState('new',null,null);};}检测用户触发浏览器返回window.onpopstate=(event)=>{console.log(event.state);alert("兄弟,你点击了返回");};