Reputation: 17
my css file has this
a:visited
{
color:red;
}
and my html page has this
<body>
<a href="http://www.w3schools.com">W3Sschools</a>
<div></div>
<a href="http://www.google.com">Google</a>
<div></div>
<a href="http://www.wikipedia.org">Wikipedia</a>
<div></div>
<script>
if($("a:visited").length){
$("a").next().html("this link is visited");
}
</script>
</body>
but it doesn't work .. so i tried another alternative in the script area
<script>
if($("a").css("color","red")){
$("a").next().html("this link is visited");
}
</script>
and it turns all my links in red even if they are not visited what's wrong with this !
Upvotes: 0
Views: 4251
Reputation: 5351
This was a security flaw that has been fixed with modern browsers. It had been possible to spit out huge amounts of link lists in a hidden div and determine, if the user visited them or not.
So this way, you could practically sniff the users history, if you only check enough links. Neither checking for :visited
, nor using the color check will do. Think of another way to do this without relying on :visited
.
Upvotes: 4