问题描述:

This goes through a REST service and displays a pdf on a new tab outside the application. How can I set the favicon for this new tab?

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

网友答案:

Add the favicon when loading the new page:

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>'
);
相关阅读:
Top