Skip to content

Instantly share code, notes, and snippets.

@seanoshea
Created July 28, 2011 17:29
Show Gist options
  • Save seanoshea/1112045 to your computer and use it in GitHub Desktop.
Save seanoshea/1112045 to your computer and use it in GitHub Desktop.
Dnd Titanium 1.1 Desktop not firing drop event
<html>
<body>
<div style="border:1px solid black;height:200px;width:200px;" id="divdrop">drop file(s) here</div>
<script type="text/javascript">
var target=document.getElementById('divdrop');
target.addEventListener('dragenter', function(event) {
event.preventDefault();
return true;
});
target.addEventListener('dragover', function(event) {
event.preventDefault();
return true;
});
target.addEventListener("drop", function(event) {
alert('drop fired');
var files = event.dataTransfer.files;
for (var i = 0; i < files.length; i++) {
var fileName=files[i].fileName;
var filePath=files[i].path;
alert('fileName ' + fileName + ' filePath ' + filePath);
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment