I had problems with the accepted answer until I realized that if you open the existing page slow , which already has a <title>
browser 1) set your title, then 2) after the document fully loads it, it (re ) will set a popup name with a "normal" value.
So, introducing a reasonable delay ( openPopupWithTitle
function):
var overridePopupTitle = function(popup, title, delayFinal, delayRepeat) { // /questions/897755/set-title-in-the-window-popup/3204648#3204648 // delay writing the title until after it fully loaded, // because the webpage actual title may take some time to appear if(popup.document) setTimeout(function() { popup.document.title = title; }, delayFinal || 1000); else setTimeout(function() { overridePopupTitle(popup, title); }, delayRepeat || 100); } var openPopupWithTitle = function(url, title, settings, delay) { var win = window.open(url, title, settings); overridePopupTitle(win, title, delay); return win; }
source share