是否有用于浏览器历史记录信息的JavaScript API(仅限当前域) [英] Is there a javascript API to browser history information (limited to current domain)

查看:46
本文介绍了是否有用于浏览器历史记录信息的JavaScript API(仅限当前域)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个编程API可以告诉我网站中最近访问过的页面(30天)是什么?

Is there a programmatic API to tell what are the recently visited pages (30 days) within my site?

我知道此类信息已存储在浏览器历史记录中。就安全性而言,我只关心脚本正在操作的站点(域)中访问的页面。
我的意图是使用(网址,标题)历史记录信息来生成自定义的最近访问页面列表。我的网站有数百万个页面。

I know such information is already stored in the browser history. As far as security, I only care about pages visited within the site (domain) the script is operating of. My intention is to use the (Url, title) history information to generate a custom recently visited pages list. My site has million of pages.

如果没有这样的标准API(此 CSS hack 不是一个),然后:

If there's no such standard API (this CSS hack not being one) then:


  1. 会发生什么理论上的安全原因是不允许给定的域查看对该域本身的访问?

  2. 还有什么其他方法可以满足我的意图?


推荐答案

历史记录api中没有任何内容可以为您提供来自域的信息。如果要执行此操作,请在页面加载时使用浏览器的localstorage来存储URL。另一种选择是在服务器上跟踪它并将其存储在数据库中。

There is nothing in the history api that will give you that information from your domain. If you want to do it, use the browsers localstorage to store the URLS when the page loads. Other option is to keep track of it on the server and store it in your database.

这篇关于是否有用于浏览器历史记录信息的JavaScript API(仅限当前域)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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