Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

windows.open() with data URI close automatically

I've a html page that generate a csv with the following code:

var encodedUri = encodeURI(csvContent);
window.open('data:text/plain,' + encodedUri,'_blank').focus();

I'm using firefox in local and it generates correctly a new tab with the data in it, but with firefox or chrome, not in local, the window opens and then close almost immediately (no popup alert triggers)

how may I avoid this and get my file with no problems?

like image 656
GodTaxist Avatar asked Jan 29 '23 16:01

GodTaxist


2 Answers

This is most probably due to AdBlock extension. I disabled it and that solved the issue for me.

like image 170
Nirav Gandhi Avatar answered Feb 03 '23 08:02

Nirav Gandhi


Apparently one of the filter lists that uBlock Origin uses comes with a rule that unconditionally blocks any data URI popups. https://github.com/gorhill/uBlock/issues/2465

like image 22
Grishka Avatar answered Feb 03 '23 06:02

Grishka