如何访问链接时隐藏链接? [英] How to hide a link if it was visited?

查看:149
本文介绍了如何访问链接时隐藏链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在访问网页时从网页中删除链接。但是......如果伪类:访问过,有隐私限制吗? (例如,我不能使用display:none)



(我想怎么做)例子:

.someclass a:link {display:block;}



.someclass a :visited {display:none;}



谢谢你们。



我也会使用外部链接,所以我不能使用jquery cookie或localstore,并且链接将通过电子邮件发送,因此我无法在类X中单击使用jquery。

解决方案

可以通过:visited伪类更改的唯一属性是颜色。这是为了响应安全问题,其中JavaScript可用于衡量链接的计算样式并确定用户是否访问过该网址。最近几年已经修补过,所以你应该避免依赖它来实现你想要的功能。请参阅此处的文章以获取更详细的说明:



http://www.impressivewebs.com/styling-visited-links/


I would like to remove a link from a page when it was visited. But...how, if the pseudo-class :visited have privacy restrictions? (i can not use display: none, for example)

(How i would like to do) Example:

.someclass a:link {display:block;}

.someclass a:visited {display:none;}

Thanks guys.

Detail: i'll use a external link too, so i can not use jquery cookies or localstore, and the links will be delivered by email, therefore i can not use jquery on click in the class "X".

解决方案

The only attribute you can change via the :visited pseudo-class is the color. This is in response to a security issue where javascript could be used to measure the computed style of a link and determine if the user had visited that url. This has been patched in the recent years, so you should avoid relying on it for functionality like you are desiring. See the article here for a more detailed description:

http://www.impressivewebs.com/styling-visited-links/

这篇关于如何访问链接时隐藏链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆