JavaScript 获取浏览器特定历史对象

发布于 2025-01-04 21:52:46 字数 352 浏览 2 评论 0原文

有很多关于 Javascript 和浏览器的历史对象的文章。但我在任何地方都找不到任何有用的内容。

我怎样才能获得特定的历史对象,假设我需要第 30 个历史对象。我怎么得到它?

例如,我有一个获取历史记录的代码

var hlist = window.history.length;
    for(i=hlist;i<=40;i++){
        ////???????
}

,如何获取循环内每个历史记录的 url?

There are lots of articles on Javascript and Browser's history object. But I cant find any useful content anywhere.

How can I get a specific history object, lets say I need 30th history object. How I get it?

for example I have a code to get history

var hlist = window.history.length;
    for(i=hlist;i<=40;i++){
        ////???????
}

How I get url of each history within the loop?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

川水往事 2025-01-11 21:52:46

出于隐私原因,历史对象受到保护。您可以前进、后退到 X 号,但您无法获取有关其实际包含内容的信息。

For privacy reasons the history object is protected. YOu can go forward, go backward got to X number, but you are not allowed to get information on what it actually contains.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文