Mathias F
Mathias F

Reputation: 15911

Read browser history

In http://www.merchantos.com/makebeta/tools/spyjax/ there is a script that reads browser history. Its not the javascript history object. It checks the color of links that changes if the link was visited or not.

Is there a script like this but in jquery?

Upvotes: 0

Views: 459

Answers (1)

BryanH
BryanH

Reputation: 6062

It doesn't read browser history, but rather relies on a "trick" that a visited link will have a different color (css :visited).

You can do the same thing by hiding all the relavent links* and then showing only the ones that have been visited:

$(function() {
  $("#somed a").hide();
  $("#somed a:visited").show();
});

Then in your code:

<div id="somed">
 <a href="http://www.facebook.com">facebook</a>
 <a href="http://twitter.com">twitter</a>
 <!-- ... more ... -->
</div>

*Or do the 'hiding' in CSS right off the bat:

#somed a {
  display:none;
}

Upvotes: 2

Related Questions