本文介绍了刷新浏览器地址栏时如何重置css(a:visited {color:green})的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功测试了XHTML文档标签上的访问链接效果。
但是,当我刷新浏览器上的
地址栏时,那些访问过的绿色链接突出显示无法删除,除非我在每个浏览器上清除所有浏览器缓存和历史记录。所以问题是如何在不清除浏览器缓存和历史记录的情况下单击浏览器刷新按钮来重置所有css?



因此,对于我的网站,我需要使用php代码做些事情,以删除我访问过的那些网站的所有cookie或历史记录,对吗?

 <!DOCTYPE html PUBLIC -  // W3C // DTD XHTML 1.0 Strict // ENhttp://www.w3.org/TR/xhtml1 /DTD/xhtml1-strict.dtd\"> 
< head>
< style>
#checkvisited {width:730px; margin-left:0px;}
#checkvisited td a {text-decoration:none; color:grey;}
#checkvisited td a:link {color :grey}
#checkvisited td a:hover {text-decoration:underline}
#checkvisited td a:active {background-color:#DEB887}
#checkvisited td a:visited {color :green}
< / style>
< / head>
< body>< div id ='checkvisited'>
< table>< td>< a href =http://yahoo.com> AA< / a>< / td>< td>< a href = //yahoo.com?a = 1> BB< / a>< / td>
< / table>< / div>< / body>< / html>


解决方案

访问过的链接,由:visited 伪类创建,它是浏览器历史记录中的一个。因此,将这些链接重新转换为未访问链接的唯一方法是将其从浏览器的历史记录中删除。



顺便说一句,您不需要 a:link 定义。 :link 用于突出显示未被访问的链接。看到 a 的基本定义和 a:visited 的定义,您的 a:link 是多余的。



然而,这里提出的解决方案旨在防止攻击者发现用户的浏览器历史记录, code> getComputedClass 来显示页面中所有访问过的链接:



:visited 的机制阅读很有帮助)


I have successfully tested visited link effect on a tag for XHTML document.But those visited link highlight with green color could not removed when I refresh theaddress bar on my browser except I click clear up all browser cache and history on every browser. So the question is how to reset all css when click browser refresh button without clear up browser cache and history ?

So for my site I need to do something with php code to delete all cookie or history about those site I visited , Right ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<style>
#checkvisited{width:730px;margin-left:0px;}
#checkvisited  td a{text-decoration:none;color:gray;}
#checkvisited td a:link{color:gray}
#checkvisited td a:hover{text-decoration:underline}
#checkvisited td  a:active{background-color:#DEB887}
#checkvisited td  a:visited{color:green}
</style>
</head>
<body><div id='checkvisited'>
<table><td><a href="http://yahoo.com" >AA</a></td><td><a href="http://yahoo.com?  a=1">BB</a></td>
</table></div></body></html>
解决方案

A "visited" link, i.e. one that gets picked up by the :visited pseudo-class, is one that is in the browser's history. So, the only way to turn those links back into non-visited links is to remove them from the browser's history.

Incidentally you don't need your a:link definition. :link is for highlighting non-visited links. Seeing as you have a base definition for a and a definition for a:visited, your a:link is redundant.

Here, however, is a proposed solution intended to defend against an attacker discovering a user's browser history by using getComputedClass to reveal all visited links in a page:

http://dbaron.org/mozilla/visited-privacy

(Almost certainly what you are looking for, but it's useful reading on the mechanics of :visited nonetheless)

这篇关于刷新浏览器地址栏时如何重置css(a:visited {color:green})的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:23