Blobs are supported.
In my case, it was actually the width and height on the image that were being set to 0 when I was using Blobs as the additional variables I was passing with my blob URL string, were 0's, so once that was discovered and corrected, it worked beautifully.
I've put in the snippet of code for anyone who wants to know what I did...
// Sample of the `svg` variable that I was using
var svg = {
url: 'blob:http://.....',
width: 0,
height: 0
};
element.addEventListener('dragstart', function(evt) {
// This was where sometimes my SVG object had 0 values.
var width = Math.min(Math.max(+svg.width, 50), 25),
height = Math.min(Math.max(+svg.height, 50), 25);
// Have wrapped it inside a DIV, as I've noticed
// on the internet a lot of issues resolved by doing so.
// (your choice)
div = document.createElement('div');
img = new Image();
// Using unescaped '#' characters in a data URI body is deprecated and will
// be removed in (Chrome) M67, around May 2018. Please use '%23' instead.
// See (https://www.chromestatus.com/features/5656049583390720 for more details).
img.src = svg.url.replace(/[#]/igm, '%23');
img.width = width;
img.height = height;
div.style.position = 'absolute';
div.classList.add('drag-image');
// For Chrome, we need to add the Image to the DOM Also....
// @see (https://stackoverflow.com/questions/43790022/html5-draggable-setdragimage-doesnt-work-with-canvas-on-chrome)
div.style.zIndex = 1000;
div.style.top = '100%';
div.style.left = '100%';
div.appendChild(img);
document.body.appendChild(div);
evt.dataTransfer.setDragImage(div, Math.round(width/2), Math.round(height/2));
});
NOTE: Not sure how HTML5's hidden
attribute will work on the added Element to the DOM. If you've got any experience on how it will work with the Drag Image, let us know with a comment below. :)