分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

JS-BOM编程之history对象

发布时间:2023-09-06 01:44责任编辑:赖小花关键词:暂无标签

History 对象包含用户(在浏览器窗口中)访问过的 URL。

History 对象是 window 对象的一部分,可通过 window.history 属性对其进行访问。

注释:没有应用于 History 对象的公开标准,不过所有浏览器都支持该对象。

history对象代表浏览器窗口上的前进和后退按钮

History 对象最初设计来表示窗口的浏览历史。但出于隐私方面的原因,History 对象不再允许脚本访问已经访问过的实际 URL。唯一保持使用的功能只有 back()、forward() 和 go() 方法。

back()加载 history 列表中的前一个 URL。
forward()加载 history 列表中的下一个 URL。
go()

加载 history 列表中的某个具体页面。

 1 <!doctype html> 2 <html lang="en"> 3 ?<head> 4 ??<meta charset="UTF-8"> 5 ??<meta name="Generator" content="EditPlus?"> 6 ??<meta name="Author" content=""> 7 ??<meta name="Keywords" content=""> 8 ??<meta name="Description" content=""> 9 ??<title>BOM编程之history对象</title>10 ?</head>11 ?<body>12 ??<!--history对象代表浏览器窗口上的前进和后退按钮-->13 ????<a href="34.BOM编程之history对象的链接对象.html">34</a>14 ????<input type="button" value="前进" onclick="window.history.go(1)"/>15 ?</body>16 </html>
 1 <!doctype html> 2 <html lang="en"> 3 ?<head> 4 ??<meta charset="UTF-8"> 5 ??<meta name="Generator" content="EditPlus?"> 6 ??<meta name="Author" content=""> 7 ??<meta name="Keywords" content=""> 8 ??<meta name="Description" content=""> 9 ??<title>BOM编程之history对象的链接对象</title>10 ?</head>11 ?<body>12 ????<input type="button" value="后退" onclick="window.history.back()"/>13 ????<input type="button" value="前进" onclick="window.history.go(-1)"/>14 ????<input type="button" value="前进" onclick="window.history.go(1)"/>15 ??16 ?</body>17 </html>

JS-BOM编程之history对象

原文地址:https://www.cnblogs.com/xiuxiu123456/p/8521003.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved