JavaScript History对象示例
<html> <head> <script type="text/javascript"> function Backurl() { window.history.back() } </script> </head> <body> <button onclick="Backurl()"> 点击我</button> <h3> No privious Url in histry list</3> </body> </html>
示例2
返回访问的URL的数量
<html> <head> <script type="text/javascript"> function myfun() { console.log("访问的地址数 :- " + history.length); } </script> </head> <body> <button onclick="myfun()">点击我</button> </body> </html>
在本文中,我将解释JavaScript中的历史对象。
JavaScript历史对象History
JavaScript历史对象包含有关用户在当前浏览器窗口上访问url的信息。Window对象包含到history对象,history对象是Window对象(Window.history)的1部分。
语法
history.length
日期:2020-04-18 01:09:22 来源:oir作者:oir