-
-
Save yaSebastian/4b787df8c199859037e21148ec4657e7 to your computer and use it in GitHub Desktop.
Amazon short URL bookmarklet
This file contains hidden or 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
| (function(d) { | |
| var asin = d.getElementById('ASIN'); | |
| var url; | |
| if (asin) { | |
| url = 'http://' + d.domain.split('.').slice(-2).join('.') + '/dp/' + asin.value; | |
| window.location.href = url; | |
| } else { | |
| alert("Can't find an Amazon product ID."); | |
| } | |
| }(document)); | |
| // Bookmarklet: | |
| // javascript:(function(d){var asin=d.getElementById('ASIN');var url;if(asin){url='http://'+d.domain.split('.').slice(-2).join('.')+'/dp/'+asin.value;window.location.href=url;}else{alert("Can't find an Amazon product ID.");}}(document)); | |
| // Alternative bookmarklet generator: | |
| // http://ted.mielczarek.org/code/mozilla/bookmarklet.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment