004.html (1143B)
1 <!doctype html> 2 <title>File drag during prompt for upload</title> 3 <style> 4 body > div { 5 height: 200px; 6 width: 200px; 7 background-color: orange; 8 display: inline-block; 9 } 10 </style> 11 <script type="text/javascript"> 12 window.onload = function () { 13 var orange = document.getElementsByTagName('div')[0]; 14 orange.ondragenter = orange.ondragover = function (e) { 15 e.preventDefault(); 16 }; 17 orange.ondrop = function (e) { 18 e.preventDefault(); 19 document.getElementsByTagName('ol')[0].innerHTML = ( e.dataTransfer.files[0] && e.dataTransfer.files[0].name == 'pass.txt' ) ? 'PASS' : 'FAIL'; 20 }; 21 }; 22 </script> 23 <div draggable="true"></div> 24 25 <ol> 26 <li>Save <a href="pass.txt">pass.txt</a> and <a href="fail.txt">fail.txt</a> onto your computer.</li> 27 <li>Drag pass.txt from your computer onto the orange square.</li> 28 <li>A prompt should appear. Do not dismiss it. If a prompt does not appear, ignore any further steps, and check the tests in ../../file/</li> 29 <li>Drag fail.txt from your computer onto a blank part of this page. Fail if this page is replaced.</li> 30 <li>Accept the prompt. Fail if nothing happens.</li> 31 </ol>