Search code examples
javascripthtmlgoogle-chromewebkit

Chrome "Copy image" option grayed out in right-click context menu


While poking around on Apple's Website using Chrome (23), I discovered that the "Copy image" context menu item was disabled (see screenshot). So it looks like Webkit has a new way of disabling this option. Does anyone know what it is?

Screenshot of disabled 'Copy image' context menu item


Solution

  • The image has an inline style of content: -webkit-image-set. When I remove this, the "Copy Image" option becomes enabled.

    Code (shortened for readability):

    <img style="content:-webkit-image-set(url(http://store.storeimages.cdn-apple.com), 1, url(http://store.storeimages.cdn-apple.com/), 2);" 
    src="http://store.storeimages.cdn-apple.com/">
    

    The idea behind the feature is to allow authors to provide multiple variants of the same image at differing resolutions, and to allow the User Agent to choose the resource that is most appropriate at the time.

    http://trac.webkit.org/changeset/111637

    Also see: http://www.brucelawson.co.uk/2012/html5-urgently-needs-adaptive-images-mechanism/

    Note that the inability to right-click and copy the image appears to be merely a side effect of the style, not an anti-download mechanism.