M4N
M4N

Reputation: 96561

when is the :visited pseudo-class applied to a hyperlink

I have some questions about the :visited pseudo-class:

(Note: I'm not trying to solve an actual problem, I'm just wondering how it works)

Upvotes: 3

Views: 407

Answers (6)

The Surrican
The Surrican

Reputation: 29866

well almost everything has been covered except one thing. when does it get applied? when the target page has its onload event. so not immediately. if you open the link in a new tab in the backgorund you will see some delay before it switches its style. tahts exactly the time the external page takes to load and for the browser to store history/trigger the change.

Upvotes: 1

Nealv
Nealv

Reputation: 6884

The :visited argument is stored in a users history file, and can only be removed locally. There is no way to controll that from a server

why do you want to set a timeout for it? maybe there is another way to get what you need.

what you can do is create a random parameter in your link like:

http://www.yourdomain.com/?<random argument>

this way the link always difers, is directed to the same link and then you just throw away the parameter.

@edit yes, it is possible, if you set a cookie and the per user check the last time the cookie was set per link(include the parameter), and if time > the time you want, refresh the parameter

Upvotes: 1

Radomir Dopieralski
Radomir Dopieralski

Reputation: 2595

You can kind of control it to your advantage by changing the link itself when its target changes. For example, I've seen some message board software that would append the message count to its topic links on the front page, so that the links you have visited would become unvisited when a new message appears in them.

Upvotes: 1

Lekensteyn
Lekensteyn

Reputation: 66415

It only applies to hyperlinks (<a href>), and when an entry is found in the browser history (not session).

Upvotes: 0

Nick Craver
Nick Craver

Reputation: 630389

It's usually stored in the browser's page history (not per session, except in the case of some sort of privacy mode perhaps).

It simply checks if that link exists in the history, if so it's :visited. As far as I'm aware, you can't control how long it's applied in any way.

Upvotes: 2

Ivo van der Wijk
Ivo van der Wijk

Reputation: 16775

It's applied when a link has been visited based on the browser history. Clearing your history will clear the visited state. There's no "timeout", as far as I know.

Upvotes: 5

Related Questions