L C
L C

Reputation: 13

How to open pdf file stored in firebase storage in next tab

creenshots

In the above image, on clicking ViewFile, i can see file URL in console (bottom right), on clicking that link, file is opening in next tab. I want file to directly open in next tab when I click on 'View File'. Below im dropping my code, can anyone help me doing it.

DownloadEvidence(){
    const files = firebase.storage().ref('pdf/498df57c-c470-40e4-8077-0fa3ae4863a4.pdf/');
    files.getDownloadURL().then((url) => {
      console.log(url);
    })
  } 

Upvotes: 1

Views: 724

Answers (2)

Jacob
Jacob

Reputation: 926

Try window.open(url, '_blank');

Upvotes: 0

Horatiu Jeflea
Horatiu Jeflea

Reputation: 7404

DownloadEvidence(){
    const files = firebase.storage().ref('pdf/498df57c-c470-40e4-8077-0fa3ae4863a4.pdf/');
    files.getDownloadURL().then((url) => {
      window.open(url, "_blank")
    })
  } 

Upvotes: 1

Related Questions