在探索Apple's Website时使用 Chrome (23),我发现“复制图像”上下文菜单项被禁用(参见屏幕截图)。所以看起来 Webkit 有一种新的方法来禁用这个选项。有谁知道这是什么吗?
最佳答案
图像具有内容的内联样式:-webkit-image-set
。当我删除它时,“复制图像”选项将被启用。
代码(为了可读性而缩短):
<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
另请参阅:http://www.brucelawson.co.uk/2012/html5-urgently-needs-adaptive-images-mechanism/
请注意,无法右键单击并复制图像似乎只是该样式的副作用,而不是反下载机制。
关于javascript - Chrome "Copy image"选项在右键单击上下文菜单中呈灰色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14125086/