Iago
Iago

Reputation: 1214

How to hide a link if it was visited?

I would like to remove a link from a page when it was visited. But...how, if the pseudo-class :visited have privacy restrictions? (i can not use display: none, for example)

(How i would like to do) Example:

.someclass a:link {display:block;}

.someclass a:visited {display:none;}

Thanks guys.

Detail: i'll use a external link too, so i can not use jquery cookies or localstore, and the links will be delivered by email, therefore i can not use jquery on click in the class "X".

Upvotes: 6

Views: 3125

Answers (2)

Jeff Cashion PhD
Jeff Cashion PhD

Reputation: 674

The only attribute you can change via the :visited pseudo-class is the color. This is in response to a security issue where javascript could be used to measure the computed style of a link and determine if the user had visited that url. This has been patched in the recent years, so you should avoid relying on it for functionality like you are desiring. See the article here for a more detailed description:

http://www.impressivewebs.com/styling-visited-links/

Upvotes: 3

Yuriy Galanter
Yuriy Galanter

Reputation: 39807

I think the closest you can get is to color the visited link same color as background e.g.

a:link {display:block;}
a:visited {color:white}

http://jsfiddle.net/NGSs8/5/

Upvotes: 1

Related Questions