这将通过 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/