Amazon has a Universal Wishlist button which can be added to the browser bookmarks bar, then pressed on any website and it sends the details of the page the user is currently looking at to Amazon. Amazon then pull out the product details out of the page and add the product to the user's wish list.
Do any libraries exist to replicate this (or similar) functionality for my own site? I could probably replicate it by copying Amazon's code using javascript, but don't want to waste my time if there already exists a library to do this or something similar that I can adapt. I'm also not really sure what this type of bookmark-button is called so it's difficult to google for.
Thanks.
It is a bookmarklet.
Usually a link that loads a script in the current page.
<a href="javascript:(function(){var s=window.document.createElement('script');s.src = 'https://yourserver.com/your.js';window.document.body.appendChild(s);}())">
drag this link to the bookmark bar
</a>
When you click the bookmark, it will execute the simple javascript code in the href
.
A script
tag is added in the current page. And load the url, here https://yourserver.com/your.js
.
At the end of the file your.js
you can call a function to execute any action. You have access to all resources of the current page(DOM, JS and cookies).