これらの回答はいずれも私にとっては役に立たなかった。私はPDFでポップアップを開こうとしていましたが、上記の方法でタイトルを設定しようとすると権限が拒否されました。私は最終的に正しい方向に私を指摘した別の記事を見つけました。以下は私が使い終わったコードです。
出典:How to Set the Title in Window Popup When Url Points to a PDF File
var winLookup;
var showToolbar = false;
function openReportWindow(m_title, m_url, m_width, m_height)
{
var strURL;
var intLeft, intTop;
strURL = m_url;
// Check if we've got an open window.
if ((winLookup) && (!winLookup.closed))
winLookup.close();
// Set up the window so that it's centered.
intLeft = (screen.width) ? ((screen.width - m_width)/2) : 0;
intTop = (screen.height) ? ((screen.height - m_height)/2) : 0;
// Open the window.
winLookup = window.open('', 'winLookup','scrollbars=no,resizable=yes,toolbar='+(showToolbar?'yes':'no')+',height=' + m_height + ',width=' + m_width + ',top=' + intTop + ',left=' + intLeft);
checkPopup(m_url, m_title);
// Set the window opener.
if ((document.window != null) && (!winLookup.opener))
winLookup.opener = document.window;
// Set the focus.
if (winLookup.focus)
winLookup.focus();
}
function checkPopup(m_url, m_title) {
if(winLookup.document) {
winLookup.document.write('<html><head><title>' + m_title + '</title></head><body height="100%" width="100%"><embed src="' +m_url + '" type="application/pdf" height="100%" width="100%" /></body></html>');
} else {
// if not loaded yet
setTimeout(checkPopup(m_url, m_title), 10); // check in another 10ms
}
}
まさに "......" とは何ですか?ウインドウをURLに開くと、そのページは一般的にヘッダーに '
それは別の内部ページです。おそらくタイトルタグがそのページにありません、それをチェックします –