Is there a javascript API to browser history information (limited to current domain)

时间秒杀一切 提交于 2019-12-11 10:48:33

问题


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.

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

  1. What would be the theoretical security reason not to allow a given domain see the visits to the domain itself?
  2. What other approaches may fit my intention?

回答1:


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.



来源:https://stackoverflow.com/questions/12978739/is-there-a-javascript-api-to-browser-history-information-limited-to-current-dom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!