Internet Explorer 9 Drag and Drop (DnD)
Well i have encountered this same weird behaviour in IE9, it appears to be that IE9 wont do a Drag and Drop (HTML 5 style) on div's. if you would change the div for a A with href="#" you will be able to drag and drop.
this won't drag:
<div data-value="1" class="loadedmodule-container" draggable="true">drag</div>
and this will:
<a href="#" data-value="1" class="loadedmodule-container" draggable="true">drag</a>
Hope this helps anyone
Dart HTML5 Drag and Drop in Internet Explorer 9
Found a solution by adding a little javascript to my main HTML filer (please tell me if you have a better idea):
<html>
<head>
<!-- some stuff -->
<script type="text/javascript">
function callDragDrop(el) {
el.dragDrop();
}
</script>
</head>
<body>
<!-- some stuff -->
</body>
</html>
Now I can call this function with Darts js-interop
:
/**
* Workaround to enable drag-and-drop elements other than links and images in
* Internet Explorer 9.
*/
void _enableIE9drag(Element element) {
if (element.draggable == null) {
// HTML5 draggable support is not available --> try to use workaround.
element.onSelectStart.listen((MouseEvent event) {
// Prevent selection of text.
event.preventDefault();
// Use the javascript function to call the native dragDrop() of element
js.context.callDragDrop(element);
});
}
}
Edit
Created a helper library to use HTML5 Drag and Drop in Dart.
HTML drag and drop in IE9
It'll work if you replace div
with a
tags. However there are a couple of other changes you ought to make, firstly make sure that the a
tags aren't clickable links by returning false
in the onclick
event:
<a class="div123" href="#" draggable="true"
ondragstart="handleDragStart(event)"
ondrop="handleDrop(event)"
ondragover="dragoveHandler(event)"
onclick="return false;">
HTML5 drag and drop
</a>
Secondly, IE9 doesn't accept parameters of text/plain
in setData
, use Text
instead or add the data inside of a try...catch
. Also, you should make sure the data you're adding is actually text:
e.dataTransfer.setData("Text", "" + $(e.target).index());
Finally your handleDrop
function needs to preventDefault
/return false
because otherwise the default action for dropping a link (an a
element`) is to navigate to the dropped URL:
function handleDrop(e) {
alert($(e.target).index());
if (e.preventDefault) {
e.preventDefault(); // Necessary. Stops redirect.
}
return false;
}
Here is a jsFiddle of your code which will work in IE9.
Exchange (Mail) Drag and Drop eMail in Internet Explorer (10)
When you drag an eMail in Outlook Web App or Exchange with the Internet Explorer it gets copied into the clipboard.
With:
window.clipboardData.getData("Text");
you can get the data. However you need to enable the clipboard option in the Internet Security Policy Settings.
Related Topics
Add Outward Curving Border to Elements Like This: ◝◟_◞◜
CSS Wrong Appearance of Border-Radius on a Nested Div
How to Make a Border Overlay Child Div
How to Change the Inner White Color of Font Awesome's Exclamation Triangle Icon
Width 100% with White Borders Around It. Why
Restoring the Value of a Input Type=File After Failed Validation
Label Text Is Wrapped But Not Indent Second Line
Are Self-Closing Input Tags Valid in HTML 4
Can Xhtml and HTML Class Attributes Value Start with a Number
Div with Triangle at the Bottom with Background Image
Center Navbar Links Without Brand Pushing It to the Right in Bootstrap 4
Line Height Issue with Inline-Block Elements
Open a Direct File on the Hard Drive from Firefox (File:///)