close-drag-002-manual.html (1334B)
1 <!doctype html> 2 <title>drag & drop - closing the only window while a drag is in operation</title> 3 <style type="text/css"> 4 p.gone, ul { display: none; } 5 p.gone + ul { display: block; } 6 </style> 7 <script type="text/javascript"> 8 window.onload = function() { 9 if( location.href.match(/#popup$/) ) { document.getElementsByTagName('p')[0].className = 'gone'; } 10 document.getElementsByTagName('ul')[0].ondragstart = function(e) { 11 e.dataTransfer.effectAllowed = 'copy'; 12 e.dataTransfer.setData('Text', 'dummy text'); 13 setTimeout(function () { window.close(); },100); 14 }; 15 }; 16 </script> 17 <p><a href="javascript:alert('Click the link normally');" onclick="window.open('close-drag-002.html#popup','_blank');return false;">Open this page in a popup</a>.</p> 18 <ul draggable='true'> 19 <li>Close all pages/browser windows except the popup.</li> 20 <li>Drag this text downwards, and do not release the drag.</li> 21 <li>The browser may optionally cancel the drag. The browser may optionally close the popup/window. Fail if the drag placeholder gets stuck. Fail if the browser crashes. Fail if anything horrible happens. Fail if zombie Michael Jackson resurects.</li> 22 <li>Release the drag.</li> 23 <li>Fail if the drag placeholder gets stuck. Fail if the browser crashes.</li> 24 </ul> 25 <noscript><p>Enable JavaScript and reload</p></noscript>