114
rated 0 times
[
116]
[
2]
/ answers: 1 / hits: 38297
/ 7 Years ago, mon, june 5, 2017, 12:00:00
I have same blob URL in two tags.
One tag has target=_blank for opening the link in new tab and the other for downloading.
The download is fine but Open in new tab just works on Firefox. For Google Chrome, it keeps flashing, opens then closes immediately after clicking the link.
<a id=view href= target=_blank>View Blob in new tab</a>
<a id=download href= download=abc.txt>Download Blob</a>
<script>
$(function(){
var myBlob = new Blob(['Hello, I am Blob content'], {type: 'text/plain'})
var url = URL.createObjectURL(myBlob);
$(a#view).attr(href, url);
$(a#download).attr(href, url);
});
</script>
Is this a Google Chrome bug? (My Chrome version is: 54.0.2840.99 x64)
Live demo here:
https://jsfiddle.net/fa0kstm5/
More From » jquery