View Full Version : Can I programatically access the visited state of a link

12-20-2003, 02:42 AM
ie, is there a property of link objects that says whether they're visited or unvisited, short of evaluating all applicable CSS rules and seeing if they match the computed style.. ?

12-20-2003, 03:23 AM
that would be my only guess on how to pull this off; i've never heard of anything that would let you do this, unless IE or Moz has some nifty way of doing it

12-20-2003, 03:58 AM
Yeah .. that's what I feared .. but that would be arguably more trouble than it's worth.

It's for an MS SAPI-based text reader I'm making, which I want to be able to say "link" or "visited link", so since it only needs to work in IE anyway, could be worth trawling MSDN for some proprietary arcana ... IE must have that information to be able to render the CSS ..

12-20-2003, 06:23 AM
The only solution I could think is if you could put a cookie on the linked page (that is, if it's your link) and make the main page read from the cookie. But since that has limited options, I'm sure php could do something. In a forum like this, it keeps track of what topics are new to you (never been clicked) after a new reply, etc.

12-20-2003, 06:55 AM
Thanks, but that's not an option either - must be a pure JS property without any data persistence or server-side interaction. I just want the state of a link, as a property of the link object.

I wonder if there's an ActiveX route that could get the information from MSHTML .. hmm ...

12-20-2003, 07:15 AM
currentStyle Object (http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/currentstyle.asp)

12-20-2003, 07:57 AM
I also found this in the SDK:

IAccessible::get_accState (http://msdn.microsoft.com/library/en-us/msaa/msaaccrf_6vs5.asp) > Object State Constants (http://msdn.microsoft.com/library/en-us/msaa/msaaccrf_8y2b.asp) :

The object is a hyperlink that has been visited (previously clicked) by a user.

-- no clue of how to use this through scripting, though...

12-20-2003, 09:38 PM
Yeah that IAccessible::get_accState looks like the one, but it's a C++ method for people writing IE extensions. I don't know of any way I can access that through JScript.

12-20-2003, 10:07 PM
Right, that may not be possible (not documented, anyway).

I also ran across the vLink (http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/vlink.asp) & vlinkColor (http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/vlinkcolor.asp) properties, which I hadn't known about...

Willy Duitt
12-20-2003, 10:45 PM
Edit: Removed post.
Evidently, currentStyle is not a consideration.