基于Javaweb JS history对象
history对象是历史对象,包含用户(在浏览器窗口中)访问的URL。history对象是window对象的一部分,可通过window.history属性对其进行访问。
history对象的属性:
length:返回浏览器已打开的历史列表中的URL个数。
console.log(window.history.length);
history对象的方法:
1. forward():
加载历史列表中的下一个URL,即跳转到下一页面。当页面第一次访问时,还没有下一个URL。
2. back():
加载history列表中的前一个URL,即返回上一个页面。
3. go(number