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:
Solution (works in Chrome and Edge):
var w = window.open(fileURL, '_blank');
setTimeout(function(){ w.document.title = 'My title'; }, 500);
Other solution (works in Chrome, FF and Edge):
var w = window.open(fileURL, '_blank');
w.document.write('<html><head><title>My title</title></head><body height="100%" width="100%"><iframe src="' + fileURL+ '" height="100%" width="100%"></iframe></body></html>');
