我正在打开一个新窗口,我正在为身体和头部注入HTML.问题出在头部:HTML包括标题和图标,但图标不显示.这是代码和jsFiddle:https://jsfiddle.net/ufnjspgc/
function Start() {
$('#TheButton').click(function() {
var TheHeadHTML = '<link href="' + window.location.protocol + '//' + window.location.host + '/favicon.ico" rel="icon" type="image/x-icon">';
TheHeadHTML = TheHeadHTML + '<title>Title Works</title>';
var TheNewWindow = window.open();
$(TheNewWindow.document.head).html(TheHeadHTML);
});
}
$(Start);
Run Code Online (Sandbox Code Playgroud)
如何让favicon出现在新窗口中?