Search code examples
jqueryhyperlinkvisited

How to check visited link using jquery without using any plugin


How to check visited link using jquery without using any plugin please help to solve this problem


Solution

  • Just check if it has the :visited property

    if ($("a#theLink:visited").length) {
        //anchor tag with id of "theLink" has been visited
    }
    

    edit: Remy Sharp has made a jquery plugin to help detect visited links.

    edit2 Look like this was security issue mozilla has fixed now, http://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/