显示任何访问者最近访问的 html 页面 [英] Show recently visited html pages by any visitor
问题描述
我想知道如何仅使用 html 和 javascript 代码显示最近访问过的页面列表.
I want to know how to show a recently visited pages' list with only html and javascript code.
我有一个网站.它有 100 个 html 文件和一个用于主页的 html (index.html),其他 (1.html, 2.html ... 99.html) 是子页面.我想在我的主页上显示一个最近访问的页面块.我试图不使用 php、asp 或任何其他服务器端语言.有什么办法吗?谢谢.
I have a website. It has 100 html files and one html (index.html) for the home page, the others (1.html, 2.html ... 99.html) are sub pages. I want to show a recently visited pages block on my home page. I am trying to not to use php, asp or any other server side languages. Is there any way to do it? Thanks.
Edit1:感谢您的回复.不过好像我没说清楚.
Edit1: Thank you for your replies. But it seems I did not make myself clear.
我希望所有访问者都能看到列表,列表不仅会显示他/她刚刚访问过的页面,还会显示任何访问者最近访问过的所有页面.
I want all visitors see the list, and the list will not only show pages that he/she has just visited, but all the recent pages that have been visited by any visitor.
推荐答案
在用户的计算机上保存 cookie.一般来说,你有这样的东西(伪代码):
Save a cookie on the user's computer. Generally, you have something like this (pseudocode):
- 读取cookie
- 解析cookie
- 将当前页面添加到列表中(并可能删除旧项目)
- 保存cookie
- 从数据创建列表
这篇关于显示任何访问者最近访问的 html 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!