9

I have run my sharepoint web site nder IE F12 developer tools, and the console mentioned the following error at the beginning of my HTML :-

SEC7115: :visited and :link styles can only differ by color. Some styles were not applied to :visited. 

So what is this error ? and how i can fix it ? Thanks

John John
  • 1
  • 72
  • 238
  • 501

4 Answers4

6

Change only the color attribute for css rules that contains :visited or :link selector

http://msdn.microsoft.com/en-us/library/ie/hh180764%28v=vs.85%29.aspx

elnino3800
  • 163
  • 1
  • 3
  • 8
4

This is a security feature. This question also deals with the same issue and contains a link to this page which is a very informative and interesting read.

Basically, :visited has the potential to pose a serious security risk to users (for example, when used in conjuction with getComputedStyle()), and consequently browsers severely restrict what you can do with it.

To fix it, remove a:visited from your list of CSS element selectors (traditionally, some stylesheets combine all the a psuedo classes: a:link, a:visited, a:hover, a:active { styles here }) and style it separately, only applying color.

Luke
  • 4,825
  • 2
  • 30
  • 37
2

Usually warning

SEC7115: :visited and :link styles can only differ by color. Some styles were not applied to :visited. 

is a false positive. Internet Explorer "F12 Development Tools" is not clever enough to figure out that

a:link, a:visited { border: solid red 1px; }

is not an information leak even tough getComputedStyle() were used. As explained at https://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/ and https://dbaron.org/mozilla/visited-privacy if :visited visually differs from :link and JavaScript can detect this difference, JS can brute force browser history.

However, IE detection of this case is poor enough that it cannot figure out that there's NO visual difference between :link (unvisited link) and :visited (visited link). I guess the heuristics are just if (selector_contains_visited && rule_contains_property_other_than_color) { emit_warning(); }.

Unfortunately, there's no much you can do to fix the issue. Most user agents have default style sheets that require author style sheet to match both :link and :visited (because common user agents do not support a pseudo selector matching both unvisited and visited links and specificity rules require using at least one pseudo selector). As a result, you have to specify :link, :visited {...} and IE will emit the above warning if rule block contains any property other that color.

Mikko Rantalainen
  • 14,132
  • 10
  • 74
  • 112
0

One possibility is to assign the existing link's color directly to either a:link or a:hover. That will not trigger IE's warnings.

a {
    color: blue;
}

a:link {
    text-decoration: none;
}

a:visited {
    color: blue;
}
Ryan Naccarato
  • 674
  • 8
  • 12