Results 1 to 2 of 2

Thread: How Do You Make Visited Links Become An Image

  1. #1
    Join Date
    Nov 2016
    Location
    New York, New York
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile How Do You Make Visited Links Become An Image

    I created a grid of div links and I would like to make it so that the divs become images in their :visited state. I recently discovered that this isn't possible in CSS because most browsers block this, and was told that the best workaround for this is through using Javascript.

    I am still fairly new to Javascript, but I am wondering how do I take a link and make its :visited state an image using Javascript? Does anyone have any pointers?

    Thank you in advance!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You can't really. If you want to do so on your own site you can sort of. This is addressed in some detail here:

    http://stackoverflow.com/questions/1...-visited-links

    The fourth answer provides a function that can be used to track a user's movements via clicks on links on your site and add a class to an element (the link's parent in this case) to signify that. If you are a little familiar with javascript, it can be fairly easily adapted to add a class name to the link itself, or to do other things. As I say, it currently adds a class to the link's parent. Since I don't know what level of familiarity you have with javascript, if you need help adapting or even just using the code, let me know.

    This will not, however, be able to track links visited from other sites, and that is the entire point of all of the security/prohibitions surrounding the use of the css visited pseudo class. Also, if the user has localStorage disabled, this will not work. Not too many users do though.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. count links visited
    By gettingThere in forum JavaScript
    Replies: 1
    Last Post: 04-06-2010, 04:38 AM
  2. Anylink dropdown menu visited links problem
    By StephanieH in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 04-17-2008, 07:38 PM
  3. Replies: 1
    Last Post: 09-04-2006, 05:18 PM
  4. Replies: 1
    Last Post: 08-04-2006, 04:43 AM
  5. Visited Links
    By crazytyler34 in forum CSS
    Replies: 2
    Last Post: 04-25-2006, 06:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •