下面的JS代码通过点击按钮控制浏览器显示上两次访问过的历史页面
<!DOCTYPE html> <html> <head> <script> function goBack() { window.history.go(-2) } </script> </head> <body> <input type="button" value="Go 2 pages back" onclick="goBack()"> <p>Notice that clicking on the "Go 2 pages back" button here will not result in any action, because there is no previous URL in the history list.</p> </body> </html>