I’d like to have a ‘recently viewed pages’ div filled by a javascript script which adds the titles and urls of new pages as they are requested by a user throughout their session on a site, by which the div’s content is also maintained by a cookie to persist between sessions.
Note: a new page added to the div’s ‘history list’ includes the clicking on href links that only contain a static variable that will thus only move the window down and not GET a completely new page. EG these links:
<a class='link' href='#john'> <a class='link' href='#mary'>
- which are two new items to be shown.
Here, are some code samples that don’t really solve the problem for me, because they do not include static variable GETs whilst on the same page:
http://community.actinic.com/showthread.php?t=33229
http://wordpress.org/extend/plugins/last-viewed-posts/installation/
Here is something that should do what you want using jQuery:
Put in a js file you include in all your pages. You also need to include jquery.cookie.js before it (http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/)
Your page must be formatted like these two test pages:
[history.html]
[history2.html]
Note that the title used for the history block is the text of the tag targetted by the link if it’s a #something href or the title of the page if it’s not.
Any coder with some knowledge of jQuery could tweak it to your specific needs.