如何清除JavaScript中的浏览器哈希历史记录 [英] how to clear browser hash history in javascript

查看:207
本文介绍了如何清除JavaScript中的浏览器哈希历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 hashchange 插件来模仿ajax导航,喜欢创建整个文件夹中的导航,例如:

I use hashchange plugin to imitate ajax navigation, i would like to create navigation throught folders, for example:

#root/->#root/folder->#root/folder/subfolder-> #root/

但是当我转到列表中的最后一个 #root/时,我想清除以前的导航历史记录

but when i go to last #root/ in list i would like to clear previous navigation history

#root/folder->#root/folder/subfolder

有能力做到这一点吗?

推荐答案

具有HTML5支持的现代浏览器支持通过window.history进行的某些操作.根据Mozilla开发人员网络上的文档,唯一受支持的操作是: 添加替换历史记录.

Modern browsers with HTML5 support supports some manipulation via window.history. According to the docs at Mozilla Developer Network, the only supported actions are to add and replace history.

因此不支持删除浏览器历史记录,但可能

Removing browser history is thus not supported, but maybe history.replaceState() can be used to suit your needs.

这篇关于如何清除JavaScript中的浏览器哈希历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆