Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chrome can not open blob in new tab

Tags:

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/

like image 768
The Anh Nguyen Avatar asked Jun 05 '17 09:06

The Anh Nguyen


People also ask

How do I open a blob link in Chrome?

To open Blob URL on Chrome iOS with JavaScript, we can use the FileReader constructor. For instance, we write: const reader = new FileReader(); const out = new Blob(['abc'], { type: 'text/plain' }); reader.

How do I open blob URL in browser?

Right-click on the webpage and click “Inspect” in the menu. When the DevTools panel opens, click on the three vertical dots in the top-right corner and select “Undock into a separate window.” Press Ctrl + F on Windows or Cmd + F on Mac devices to find the blob URL. Enter “ blob:HTTP ” to find the link for the video.

Why New tabs are not opening in Chrome?

If your internet is down, Chrome won't work. Make sure your Wi-Fi or cellular connection is switched on. Try opening another webpage or running an application that requires Internet access to function. If the page or the application fails too, that means the problem is with your network connection instead of Chrome.

How do I force Chrome to open in a new tab?

Right-clicking on a link and selecting "Open Link in New Tab" also opens the link in a new tab on Chrome, even without the Chrome Toolbox extension. In addition, you might be able to click the middle button or wheel on your mouse to open a link in a new tab, depending on your mouse settings.


1 Answers

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

like image 82
Raffi Avatar answered Sep 18 '22 14:09

Raffi