本文介绍了HTML5 在窗口之间拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何都可以使用 HTML5 Drag &拖放功能或/和文件 API 将 jpg 图像从一个窗口拖到另一个窗口?

is there anyway with the HTML5 Drag & Drop functionality or/and the File API to drag an jpg image from one window to another?

这个想法是,我可以使用自定义 HTML 将图像从 Facebook 拖动到不同的浏览器窗口,以获得该图像.

The idea is that I could drag and image from Facebook to a different browser's window with a custom HTML that would get that image.

或者,至少,一种从桌面拖动到浏览器的方法?

Or, at least, a way to drag from the Desktop to a browser?

非常感谢

推荐答案

在 Windows 之间不确定,但肯定来自桌面:

Not sure about between windows, but certainly from the desktop:

http://studio.html5rocks.com/#Photos

实际上,请查看完整的 html5rocks.com 站点以获取想法.

Actually, check out the full html5rocks.com site for ideas.

我刚刚打开了这个演示两个独立的浏览器窗口,我可以从一个窗口拖到另一个窗口.我还能够从 Facebook 拖动缩略图并将其放入拖放区.

I just opened this demo in two separate browser windows, and I can drag from one window to the other. I was also able to drag a thumbnail from Facebook and drop it into a drop zone.

但是,Facebook 图像被删除为未知".所以看起来你可以从一个站点掉到另一个站点,但我不确定到底是什么被丢弃了.如果您是从 Facebook 等拖拽,Facebook 可能需要将图像或元素设置为 draggable 属性集或您的应用程序可以读取的其他内容.

However, the Facebook image was dropped as "unknown". So it looks like you can drop from one site to another, but I'm not sure what exactly really gets dropped. If you are dragging from Facebook or such, Facebook may need to have the images or elements have the draggable property set or something else that your application can read.

最重要的是,您应该能够使其在您可以控制的应用程序之间工作.但是,如果您尝试将其与外部应用程序集成,则需要进行一些实验以找出在拖/放过程中到底传递了什么.这个工作我自己没做过,不过应该不难.

Bottom line is that you should be able to make it work between applications that you have control over. But if you are trying to integrate it with external apps, you will need to do some experimentation to find out what exactly gets passed during the drag/drop. I haven't done this work myself, but it shouldn't be hard.

这篇关于HTML5 在窗口之间拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 09:16