Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable text drag and drop

There is a common feature of modern browsers where a user can select some text and drag it to an input field. Within the same field it causes moving of text, between different fields it does copying. How do I disable that? If there is no portable way, I am mostly interested in firefox. This is an intranet webapp, so I am also interested in modifying the browser/getting a plugin to do this. Maybe some system-level settings (I`m on windows XP)?

I need to keep the default select-copy-paste functionality.

The background is I have multiple-field data entry forms, and users often drag something by mistake.

like image 888
maniek Avatar asked Oct 19 '09 15:10

maniek


People also ask

Can you disable drag and drop?

Steps to Disable Drag and Drop on Windows 10 In order to turn off Drag and Drop, you actually need to change the Drag and Drop sensitivity settings. In other words, you're going to set the Drag and Drop keys to a very high value. Basically, this value needs to be higher than your screen resolution.


1 Answers

For archival purposes:

<body ondragstart="return false" draggable="false"
        ondragenter="event.dataTransfer.dropEffect='none'; event.stopPropagation(); event.preventDefault();"  
        ondragover="event.dataTransfer.dropEffect='none';event.stopPropagation(); event.preventDefault();"  
        ondrop="event.dataTransfer.dropEffect='none';event.stopPropagation(); event.preventDefault();"
>

does what I wanted. You can add the ondrag* handlers to form elements, too, like <input ondragenter=...>

reference url: https://developer.mozilla.org/En/DragDrop/Drag_Operations

like image 186
maniek Avatar answered Nov 16 '22 02:11

maniek