BigBadMe
BigBadMe

Reputation: 1842

itemprop="image" on element not <img>?

I have a product page that uses Microdata. At the moment the itemprop="image" attribute is specified on the first thumbnail from my thumbnail gallery. What I'd like to do is specify it for the high-res image I have.

The trouble is, that's not actually displayed on the page, it's loaded via JavaScript using a lighbox. I know I can do something like:

<img itemprop="image" src="/img/high-res.jp" style="display:none" />

and the image won't show and it's tagged as the product image. But, of course the image is still download.

Any way I can specify itemprop="image" on an image but not actually download the image?

I tried changing <img> to <span> but the testing tool didn't recognise it.

Upvotes: 2

Views: 2798

Answers (1)

Paul Watson
Paul Watson

Reputation: 371

Perhaps the link element would be useful here - it's not displayed in the rendered HTML, but it is available in the HTML source and therefore available to JavaScript:

<link itemprop="image" href="/img/high-res.jpg">

Upvotes: 4

Related Questions