禁用 Opera 的 Ctrl-Click 以编程方式保存图像?
我正在开发一个网络应用程序,它模拟桌面的通用文件浏览器,但用于上传的文件。它为用户提供了文件夹的多个“视图”,例如列表、详细信息和缩略图。它允许他们使用 Shift 和 Ctrl 单击组合一次选择多个文件,以进行类似于传统文件浏览器的批量文件操作。
不幸的是,Opera 的默认行为是在您按住 Ctrl 键单击图像时下载图像,这会破坏在缩略图视图中按住 Ctrl 键单击多选的功能。
我知道 Opera 允许您为自己的浏览器禁用此功能,但从用户体验的角度来看,我希望避免在页面上放置一条消息来指导用户如何执行此操作,或者更糟糕的是,不必提供Opera 用户可以使用多选功能。
是否有一个元标记或一些 JavaScript 魔法我可以用来告诉 Opera 在用户按住 Ctrl 键单击图像时不要下载图像?
I'm developing a web app that emulates a generic file browser for the desktop, but for uploaded files. It offers the user multiple "views" for a folder, such as list, details, and thumbnails. It allows them to use their Shift and Ctrl click combinations for selecting multiple files at once for bulk file operations similar to a traditional file browser.
Unfortunately, Opera's default behavior is to download an image when you Ctrl-Click on it, which ruins the Ctrl-Click multi-select while in the thumbnails view.
I'm aware that Opera allows you to disable this for your own browser, but from a UX perspective I'd like to avoid having to place a message on the page instructing users how to do that, or even worse, having to not offer that multi-select feature to Opera users.
Is there perhaps a meta tag or some javascript wizardry I can use to tell Opera not to download an image when a user Ctrl-Clicks it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面是一个说明问题的小代码片段(请注意,这是一个快速测试,在 IE 中不起作用):
当您按住 Ctrl 键并单击图片时,Opera 会打开“另存为对话框”,只是因为它是
标签。值得注意的是,常规事件取消不起作用:
背景图像似乎不受影响:
所以到目前为止,我最好的解决方法是使用任何其他标签而不是
。如果我发现更好的东西,我会报告。
Here's a little code snippet that illustrates the issue (please note it's a quick test and it doesn't work in IE):
When you Ctrl+click on a picture Opera opens a "Save as dialogue" only because it is an
<img>
tag. It's worth noting that regular event cancellation does not work:Background images do not seem affected:
So my best workaround so far is to use any other tag instead of
<img>
. I'll report back if I find something better.