Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I check if a link is already visited?

Status
Not open for further replies.

xlocalghostx

Technical User
Jul 31, 2002
3
BG
Ok my goal is to mark with a special gif image a link which is already visited. Please help me check with Javascript if the link is visited...


Thanks a lot
 
the first thing that comes to mind is setting a cookie when a page is visited and then if that cookie is present in the home page show the image. In the grand scheme of things ASP could do this for you in a few lines but if you must stay client then I think that would be the way to go. You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
The browser knows if a link has been visited, uses this knowledge to implement
Code:
 a:visited
and
Code:
 a:link
stylings. Seems likely you could check the links
Code:
 style.color
property for link status -- if the current color is the same as the
Code:
 a:visited
setting you could deploy the spiffy image.

There may be browser/platform quirks and this could turn into something of a project. (Can users override link and visited settings?) Sometimes the actual value of a DOM Style property isn't available to JavaScript until after the script has written to the property.
 
I know that this isn't exactly what you want to do, but you could use CSS to set the A:VLINK attribute to say, a different color. Or maybe there's some way to use this with JavaScript...

Sorry I'm can't realy help any more, but it's just a thougth

:D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top