Show recently visited html pages by any visitor

I want to know how to show a recently visited pages' list with only html and javascript code.

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 <strong>recently visited pages</strong> 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.

<strong>Edit1</strong>: 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.

Answer1:

I would look into using HTML5 Local Storage

It's essentially a DBMS stored right on the user's browser. Of course, it's not supported in IE < 8, so if universal cross-browser support is a requirement, this might not work for you.

Answer2:

Save a cookie on the user's computer. Generally, you have something like this (pseudocode):

    <li>read cookie</li> <li>parse cookie</li> <li>add current page to list (and probably delete old items)</li> <li>save cookie</li> <li>create list from data</li> </ul>

    Answer3:

    Its possible to use javascript local storage or css a:visited if you want to create that list for just one user: the viewing user.

    You cant share the list with other users.

    Answer4:

    Try tjis with the javascript history object. Check the link below. With the history object you can access the recently viewed pages and manipulate them. But if the user clears the cache then the data is lost.
    http://www.javascriptkit.com/jsref/history.shtml

    Answer5:

    You could use cookies to store which pages a user has visited already.

    http://jquery-howto.blogspot.com/2010/09/jquery-cookies-getsetdelete-plugin.html

    人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:Show recently visited html pages by any visitor