这是我的尝试,如果它在newtab上打开,但它总是显示测试pdf 作为标题
function titlepath(path,name){
alert(path);
alert(name);
document.title = name;
window.open(path, '_blank');
}
答案 0 :(得分:3)
此解决方案适合我。 问题:如何更改新打开的标签中的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();
}