Reputation: 508
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 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: 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.
Upvotes: 2
Views: 5477
Reputation: 7371
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
Upvotes: 0
Reputation: 53
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
Upvotes: 0
Reputation: 1805
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.
Upvotes: 0
Reputation: 129109
Save a cookie on the user's computer. Generally, you have something like this (pseudocode):
Upvotes: 1
Reputation: 83366
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.
Upvotes: 1