24
votes

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/

1
the demo link you provided is working fine in chrome at my end and this is the new tab link : blob:fiddle.jshell.net/1ada3411-bfba-461d-83cf-ebfe301e02d8. Try it on chrome Version 58.0.3029.110Deepa
worked fine for me in chrome - opened in a new tabPete
Thanks guys, I've tested in other PC. It's ok. So maybe My PC's Chrome has something wrong.The Anh Nguyen
No, this has been occurring for us lately as well. We have a new tab open programmatically at the beginning of a process, then a blob URL is later set to it. This previously worked fine in both Chrome and Firefox, but now it is only working in Firefox. Currently trying to find a solution as this causes issues for our clients and we've had to forego the blob tab which offers us more flexibility in what we do...Chrysus
It doesn't work on my Chrome 61.0.3163.100 x64, but when I stop AdBlock on jsfiddle, it works fine, as @Raffi said.clabe45

1 Answers

69
votes

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."