开发者

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 li开发者_开发知识库nk was visited or not.

Is there a script like this but in jquery?


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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜