Created
May 31, 2015 16:32
-
-
Save filipelinhares/ffd43fc2cb02da7ce1f8 to your computer and use it in GitHub Desktop.
Link visited with Local Storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localStorage.setItem('visited-'+window.location.pathname,true); | |
var links = document.getElementsByTagName('a'); | |
for (i=0;i<links.length;i++) { | |
var link = links[i]; | |
if (link.host == window.location.host && localStorage.getItem('visited-' + link.pathname + '/')) { | |
link.dataset.visited = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment