FF2 (at least) doesn\'t mark as link as :visited if it triggers the onclick handler without following the href. I\'m using onclick to fetch data from a server and modify th
Is there a way to determine the browser's a:visited styling?
I would say yes since the current document is visited and you can find it's link color like this:-
alert(mys_getLinkColor(top.location))
function mys_getLinkColor(href) {
var x, body, res=''
x = document.createElement('a')
x.href = href
body = document.getElementsByTagName('body')[0]
body.appendChild(x)
if(x.currentStyle) {
res = x.currentStyle.color
}
else if(window.getComputedStyle) {
res = window.getComputedStyle(x,null).color
}
return mys_rgbToHexColor(res) }
function mys_rgbToHexColor(v) {
// E.g. 'rgb(5,2,11)' converts to "#05020b". All other formats returned unchanged.
var i
v = v.split('(')
if(!v[1]) return v[0]
v = v[1].replace(/ /g, '').replace(/\)/, '')
v = v.split(',')
for(i=0; i