Prevent / prohibit page Back

UA Import from  ' ./devices ' // use environment determination 

function removeHistory () { 
  IF (ua.isApp ()) {
     // prevent reverse page 
    history.pushState ( null , null , document.URL) 
    window.addEventListener ( ' the popstate ' , function () { 
        history.pushState ( null , null , document.URL) 
    }) 
  } 
} 

Export default removeHistory ()
Back when the principle is invoked popsstate 
after history.pushState method by adjusting the current address of the address bar, 
so every retreat is called the current page

 

Guess you like

Origin www.cnblogs.com/Model-Zachary/p/11532682.html