Skip to content

Instantly share code, notes, and snippets.

@scottwb
Created April 14, 2010 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottwb/366373 to your computer and use it in GitHub Desktop.
Save scottwb/366373 to your computer and use it in GitHub Desktop.
JS to detect if the user has been to certain URLs.
%div#whereyoubeen{:style => "display:none"}
%a{:href => "http://www.google.com/"} Google
%a{:href => "http://www.amazon.com/"} Amazon
%a{:href => "http://www.yahoo.com/"} Yahoo
%a{:href => "http://www.neimanmarcus.com/"} Neiman Marcus
%a{:href => "http://www.strings.com/"} Strings
%a{:href => "http://www.huffingtonpost.com/"} Huffington Post
:javascript
alert("You have been to: " + $$('#whereyoubeen a:visited').map(function(link) {return link.innerHTML;}).join(','));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment