vendredi 29 octobre 2021

Browser tab title with Angular when using window.open(...)

In the code behind, I open a new browser tab (window) with a PDF as content, from data as blob from the server. It works, a new tab opens with the document, but the title of the tab of the browser is some hex code. Could dynamically I change this browser tab title? "Document" for example?

Here is the code I use (sorry, could not do a StackBlitz sample as the data comes from a server):

const file = new Blob([data], {type:'application/pdf'});

const fileURL = URL.createObjectURL(file);

window.open(fileURL, '_blank');

And here, how my browser tab looks like:

Browser tab




Aucun commentaire:

Enregistrer un commentaire