Cannot change the content of visited :before pseudo-elements
Asked Answered
Y

2

9

I was trying to add some effects for visited links, then I got this problem.

Here is the code: http://dabblet.com/gist/5447894

Only Opera can successfully change the content of :before pseudo-elements. All other browsers are fail. Did I miss anything? Thanks

Yamamoto answered 23/4, 2013 at 22:46 Comment(1)
possible duplicate of Firefox 4 not rendering a:visited::before (except color)Audry
S
16

The allowed (= not ignored) CSS properties of visited links are color, background-color, border-*-color, outline-color and, column-rule-color (more under certain circumstances).

This is to prevent history stealing attacks. See this article for further details.

So you can, technically, set a :before pseudo class for :visited links, but it will be ignored and appears as if the links are not visited. This is not a bug, it's a feature ;)

Spender answered 23/4, 2013 at 22:52 Comment(1)
It means opera has lack of security!Lectureship
C
3

There is a very limited range of possibilities for styling :visited links in modern browsers for privacy reasons – so that you couldn't detect which sites the user has visited before by checking the computed style with javascript.

The allowed properties for styling for :visited links is

  • color
  • background-color
  • border-color (and its sub-properties)
  • outline-color
  • The color parts of the fill and stroke properties

Even so, you cannot get the values of the computed style for visited links via javascript.

You can read more about it here.

Callao answered 23/4, 2013 at 22:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.