Skip to content

Instantly share code, notes, and snippets.

@filipelinhares
Created May 31, 2015 16:32
Show Gist options
  • Save filipelinhares/ffd43fc2cb02da7ce1f8 to your computer and use it in GitHub Desktop.
Save filipelinhares/ffd43fc2cb02da7ce1f8 to your computer and use it in GitHub Desktop.
Link visited with Local Storage
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