The bookmarklet today is going to grab a super high-res photo of Amazon Products. Ok, let me explain a little bit more. So, a designer co-worker uses super high-res product images for design mockups. Well, he typically would go scouring the internet for these images. However, he noticed that on Amazon product pages you can look at really large images of products using their Zoom viewer, but you could right-click and download the image from there. So I created a simple bookmarklet to grab the product id from the page url and then open up a link to the large image.
Okay, back to work. So a typical link which can be turned into a book looks like:
And the code looks like.
And the code would be:
Now, that just covers the basics of the syntax we are going to use for this. You can see above that to tell the browser to run our
Looking at the code we start by creating anonymous function and inside the function we create a new
Date object, then use it to create a string of hours and minutes, and then show this (current time) in an alert.
So, now if you want to make this a Bookmarklet simply do one of two things.
- Drag the link to your bookmark toolbar.
- Create a bookmark. Copy the location of the link above and change location of the new bookmark you just created.
The code starts with creating a regular expression that pulls the product id from a url. Next we run the expression on the current page url – it won’t work on this page – using the
match to run the expression. Then the url for the large image is created. The last thing is to change the url of the page to go to the large image. Really, that is about it. For a link we wrap it with the aforementioned function and the
And the link: