Utility of the new global attribute Dropzone in HTML5?

Asked

Viewed 178 times

1

Who knows the goal of the new global attribute Dropzone added in HTML5 and would also like to know which browser supports it? Thank you!

1 answer

2


First I want to make it clear that the attribute dropzone="" is not yet supported by any browser, so as much as try to use it will not work and it is still experimental, ie it may become standard as can also be removed from the standards of the W3 even before any browser can implement it.

Any html element can use the attribute dropzone having more than one value or not, these values must be separated by spaces, the supported values are:

  • copy (example: <div dropzone="copy">)

    Indicates that the element will accept the drop an item of the specified type and will result in a copy of the dragged data.

  • move (example: <div dropzone="move">)

    Indicates that the element will accept the drop an item of the specified type and the dragged data will be moved to the new location.

  • link (example: <div dropzone="link">)

    Indicates that the element will accept the drop an item of the specified type and will result in a link with the data.

  • Limiting by file type:

    <div dropzone="copy f:image/png f:image/gif f:image/jpeg">
    

    This will limit image, png, jpeg and gif data

In short, as far as I understand in W3.org, the idea is that if you move an image in the area that has the element you can limit the types of files or other elements that can be "dropped" in the element with the attribute dropzone="", these files or elements will result in data that can probably be read by DOM API browser javascript, but it’s like I said no browser supports this yet and we don’t know if this attribute will ever be released.

However it is possible to do Dropzone without the attribute, using events such as ondrag and ondrop, combining with the File API or DOM API (will depend on what you want to release in this zone).

  • could you write more about the link value? Thank you!

  • 1

    @Ingridfarabulini I will try, but to write about something that still "doesn’t exist", or better only exists on paper is a bit difficult, since I can not do tests to confirm the functioning.

  • 1

    Yes, you’re absolutely right. Even if you don’t, thank you very much, an excellent and beneficial explanation for the whole community. Congratulations :)

  • I found some "reports" on the Internet, maybe tomorrow I can read the whole text (they are in English, I’m a little slow to read and understand) and add details, but it seems that at least the first one I read also uses the term "supposedly", I mean it’s still not quite clear the objective, as soon as you add more details I call you via comment.

  • 1

    It is worth saying that this makes sense when it comes to drop from the OS to the browser, so there is the definition of mime-types and the type of operation. For example: dragging a PC icon to browser in a "move" means deleting it from the PC if the operation is successful. Dragging to a "copy" means an upload without deleting the original. Dragging a "link" means sending only the reference, without upling anything (I’m talking about the theoretical workings, as to what will actually happen, may not make any sense, like many other W3 decisions that are counterintuitive).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.