Hi, I want to grab the image src on a product page in a e commerce website.
I'm writing this as a bookmarklet, so I'd like the code to work universally as possible.
I've noticed that there are only two reoccurring factors in the product image tag among top e-commerce websites (amazon, bestbuy ect.): border=0
and 180<width&height<400
.
So how could I write a selector that would give me the src
of the first img
element on the page with no border and width & height between 180 and 400 px? Or is there a better way of doing this?
P.S. since I'm trying to keep the bookmarklet as light as possible, I don't want to use any libraries (jquery, yui etc)