2017-09-08 56 views

回答

0

好,有完整的评价和测试,例如:

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <title>Test</title> 
    <script> 
     // Add actual page to history 
     history.pushState(null, null, location.pathname) 

     // Register back button click 
     window.onpopstate = function (e) { 
     // Prevent default action on back button click 
     e.preventDefault() 
     // Add actual page to history again 
     history.pushState(null, null, location.pathname) 
     } 
    </script> 
    </head> 
    <body> 

    </body> 
</html> 
+0

我把它放在HTML头它不工作,谢谢回复! – Linvincible

+2

您应该解释您的解决方案做了什么。只有代码答案是不鼓励的。 – Jens