HTML5: dragover(), drop(): how get current x,y coordinates?

The properties clientX and clientY should be set (in modern browsers):

function drag_over(event) {
    console.log(event.clientX);
    console.log(event.clientY);
    event.preventDefault();
    return false;
}
function drop(event) {
    console.log(event.clientX);
    console.log(event.clientY);
    event.preventDefault();
    return false;
}

Here’s a (somewhat) practical example that works in Firefox and Chrome.

Leave a Comment