013.xhtml (1152B)
1 <?xml version="1.0" encoding="utf-8"?> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>SVG image drag and drop and history navigation roundtrip</title> 5 <style type="text/css"> 6 img 7 {margin:0 2px;} 8 </style> 9 <script type="application/ecmascript"> 10 function addImage(event) 11 {var c = document.createElement('img'); 12 c.setAttribute('src',event.dataTransfer.getData('text/uri-list').replace(/\r\n$/,'')); 13 document.querySelector('p').appendChild(c);} 14 </script> 15 </head> 16 <body> 17 <p><img ondragstart="event.dataTransfer.effectAllowed = 'copy';window.location = 'helper-drag-image-dont-drop.xhtml'" ondragenter="event.preventDefault()" ondrop="addImage(event)" ondragover="return false" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20version%3D%221.1%22%20width%3D%22100px%22%20height%3D%22100px%22%20viewBox%3D%220%200%20100%20100%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22green%22/%3E%3C/svg%3E" alt="SVG circle"/></p> 18 <p>Drag circle around. You will be redirected to new page. When you return back drop circle on itself. It should be duplicated once you drop it.</p> 19 </body> 20 </html>