gpt4 book ai didi

javascript - 为 window.open 设置新的图标

转载 作者:行者123 更新时间:2023-11-29 22:05:27 25 4
gpt4 key购买 nike

这通过 REST 服务并在应用程序外部的新选项卡上显示 pdf。如何为这个新标签设置图标?

window.open(App.Config.appPath('doc/images/pdf'),'Image');

最佳答案

加载新页面时添加图标:

var newWindow = window.open(App.Config.appPath('doc/images/pdf'), '_blank');
var script = "<sc" + "ript>"
+ "(function() {" + " var link = document.createElement('link');" + " link.type = 'image/x-icon';" + " link.rel = 'shortcut icon';" + " link.href = 'link to favicon.ico';" + " document.getElementsByTagName('head')[0].appendChild(link);" + "}());" + "</sc" + "ript>";

newWindow.document.writeln(
'<html><head><title>My title</title>' + script + '</head>' + '<body onLoad="self.focus()">' + '</body></html>'
);

关于javascript - 为 window.open 设置新的图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21241612/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com