I am loading a file into a new browser tab from a URL via JavaScript. In this case it is a PDF file, but it can be other types too. It all works fine except that the browser tab always says "untitled". I want it to (ultimately) say the file name. For now I am just using "My Title". I am using this:
var loadFile = function (url) {
var newwin = window.open(url);
newwin.addEventListener("load", function() {
newwin.document.title = 'My Title';
});
};
When I run it through the Chrome debugger, I see newwin.document.title is blank. Very surprisingly, it is still blank after the assignment. I'm really lost.