[英]How to set title for pdf file opening in new tab (_blank) in browser
这是我的尝试,是否已在newtab上打开,但始终显示测试pdf作为标题
function titlepath(path,name){
alert(path);
alert(name);
document.title = name;
window.open(path, '_blank');
}
这个解决方案对我有用。 问题:如何在新打开的选项卡中更改pdf的标题
function titlepath(path,name){
//In this path defined as your pdf url and name (your pdf name)
var prntWin = window.open();
prntWin.document.write("<html><head><title>"+name+"</title></head><body>"
+ '<embed width="100%" height="100%" name="plugin" src="'+ path+ '" '
+ 'type="application/pdf" internalinstanceid="21"></body></html>');
prntWin.document.close();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.