How to Hide Visited HTML Links

You can use the "a:visited" pseudo-class selector to apply CSS styles to links that a user has already visited. However, many websites have employed this capability in various ways to cull the contents of users' Web browsing histories. In response to this, Web browsers have significantly limited the "a:visited" pseudo class and changed the behavior of certain JavaScript routines to prevent these exploits. Your best bet for hiding visited links on your Web page is to change their color to match the background color of the page; they will still be clickable and take up space on the page, but will not be visible.

Instructions

    • 1

      Place the following code between the "head" tags of your HTML document:

      <style type="text/css">

      a:visited {color:white;}

      body {background-color:white;}

      </style>

      Substitute any valid CSS color for "white" to choose the background color of your page. For example, you can use RGB values like "rgb(0,255,0)" and hexadecimal values like "#00FF00."

    • 2

      Add a CSS class for any other elements that may contain anchor tags, specifying the same value for the "background-color" property. The following example can be added to the "style" tags in the code from Step 1:

      .linkContainer {background-color:white;}

      Any opaque element in the body of your HTML document should include "linkContainer" in its "class" attribute if it will have links inside it.

    • 3

      Remove the "background" and "bgcolor" attributes from the "body" tag, if they are present.

    • 4

      Save the HTML document, then load it in a Web browser. Click a link, then return to your page and see that the link you visited is not visible.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured