CSS pseudo class combinations

2019-06-28 04:34发布

问题:

How can I style a anchor tag so that once the link is visited it will change to Red and append [Old] to the end of the link.

So how do I combine these two:

a:visited{
   color:Red
}
a:after{
   content:[Old]
}

回答1:

This is a privacy issue. As browser can detect element styles, it can therefore know what sites did you visit. An right now JS can detect it for a very large number of links in very short time. So for security reasons modern browser's ability to detect :visited class is severely cutted down.

Read more about it on mozilla's blog: http://blog.mozilla.com/security/2010/03/31/plugging-the-css-history-leak/

Citation from Webkit changelog:

http://support.apple.com/kb/HT4196

Impact: A maliciously crafted website may be able to determine which sites a user has visited

Description: A design issue exists in WebKit's handling of the CSS :visited pseudo-class. A maliciously crafted website may be able to determine which sites a user has visited. This update limits the ability of web pages to style pages based on whether links are visited.

Similiar questions (have more links):

  • Google chrome a:visited background image not working
  • How can I remove the underline of a link in chrome using CSS?