javascript - Chrome "Copy image"选项在右键单击上下文菜单中呈灰色

标签 javascript html google-chrome webkit

在探索Apple's Website时使用 Chrome (23),我发现“复制图像”上下文菜单项被禁用(参见屏幕截图)。所以看起来 Webkit 有一种新的方法来禁用这个选项。有谁知道这是什么吗?

Screenshot of disabled 'Copy image' context menu item

最佳答案

图像具有内容的内联样式:-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/

相关文章:

html - Google 分析出现问题,拒绝连接,因为它违反了以下内容安全政策指令

JavaScript:字符串匹配后返回 anchor 标记

javascript - React Native fetch 和 componentDidMount

jquery - float 框欠输入

javascript - 我的选择过程不匹配?

javascript - Date.now() 无法在 Float32Array 中更新

html - 第一个字母使 Chrome 在错误的位置突出显示

javascript - Chrome WebSocket 连接立即关闭

javascript - ocpsoft重写ConfigurationProvider注册失败

javascript - JS Lint 错误 : Don't make functions within a loop - No workaround