Javascript 在Google Chrome中执行window.open()时,Favicon不会显示
在Google Chrome中,当我使用JavaScript函数Javascript 在Google Chrome中执行window.open()时,Favicon不会显示,javascript,google-chrome,Javascript,Google Chrome,在Google Chrome中,当我使用JavaScript函数window.open()创建一个新选项卡,然后添加一个favicon时,创建的新选项卡不会显示favicon 以下是重现错误的代码示例: var w = window.open(); var link = w.document.createElement('link'); link.id = 'fav'; link.rel = 'icon'; link.type = 'image/x-icon'; link.href = 'htt
window.open()
创建一个新选项卡,然后添加一个favicon时,创建的新选项卡不会显示favicon
以下是重现错误的代码示例:
var w = window.open();
var link = w.document.createElement('link');
link.id = 'fav';
link.rel = 'icon';
link.type = 'image/x-icon';
link.href = 'https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico';
w.document.head.appendChild(link);
favicon显示在Firefox中,但不显示在Chrome中(使用Chrome58进行测试)
(要测试示例代码,请授权浏览器打开新的弹出窗口)
我怎样才能让它工作?这是预期的Chrome行为还是bug 我遇到了类似的问题,我打开了一个窗口,将Ajax帖子中的数据作为内容放置,即使我将图标链接更改为base64,即未链接到托管Ico,也无法显示我遇到了类似的问题,我正在打开一个窗口,将来自Ajax帖子的数据作为内容放置,即使我将图标链接更改为base64,即不链接到托管Ico,它也无法显示