Open new tab with AngularJs [closed]

0

I'm trying to visualize a PDF that returns an API.

The code with which it worked so far is this:

$http.get(urlApi,{responseType:'arraybuffer'})
      .success(function(data) {

        var file = new Blob([data], {type: 'application/pdf'});
        var fileURL = URL.createObjectURL(file);
        window.open(fileURL);

      });

Until now it worked correctly, but for a couple of days when the new tab opened, it closes instantly.

I have been doing tests and with the code:

window.open(fileURL, "_self");

It works correctly, the problem is that it obviously opens on the same tab, and it's not what I'm looking for, I need it to be in a new one.

Can you think of any idea of how to open the PDF in a new tab without it closing?

    
asked by Diego 09.03.2017 в 12:09
source

3 answers

1

To open a new tab use:

window.open(fileURL, '_blank');
    
answered by 09.03.2017 в 12:11
1

According to this documentation using _blank would help you.

    
answered by 09.03.2017 в 12:12
0

The solution is: Uninstall Adblock

    
answered by 09.03.2017 в 12:35