这是我的尝试,如果它在 newtab 上打开,但它总是显示 test 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();
}
关于javascript - 如何在浏览器的新标签页 (_blank) 中设置打开 pdf 文件的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50759857/