UPDATE: Code no longer works accross all browser.
The reason is pretty clear – History Theft !
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<script language="JavaScript"> function hasLinkBeenVisited(url) { var link = document.createElement('a'); link.href = url; document.body.appendChild(link); if (link.currentStyle) { //IE var color = link.currentStyle.color; //alert("[IE] url:"+url+", color:"+color) if (color == '#800080'){ return true; } } else { // Firefox link.setAttribute("href",url); var computed_style = document.defaultView.getComputedStyle( link, null ); if (computed_style) { //alert("[FIREFOX] url:"+url+", computed_style.color:"+computed_style.color) if (computed_style.color == 'rgb(128, 0, 128)') { return true; } } } return false; } |