Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
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

 Answers
88

The cause may be AdBlock. There is a discussion at StackOverflow here: Open blob objectURL in Chrome.



To disable AdBlock, click the AdBlock icon next to your location bar, then Don't run on this page or Don't run on pages in this domain.


[#57562] Thursday, June 1, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alejandro

Total Points: 231
Total Questions: 102
Total Answers: 107

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
alejandro questions
Mon, Jul 18, 22, 00:00, 2 Years ago
Fri, Sep 18, 20, 00:00, 4 Years ago
Thu, Sep 10, 20, 00:00, 4 Years ago
;