如何在浏览器的新选项卡(_blank)中设置pdf文件打开的标题 [英] How to set title for pdf file opening in new tab (_blank) in browser
本文介绍了如何在浏览器的新选项卡(_blank)中设置pdf文件打开的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的尝试,如果它在newtab上打开,但它始终显示测试pdf 作为标题
This is my try, were it opened on newtab, But its always showing test pdf as title
function titlepath(path,name){
alert(path);
alert(name);
document.title = name;
window.open(path, '_blank');
}
推荐答案
此解决方案适合我。
问题:如何更改新打开的标签中的pdf标题
This solution works for me. Question: How to change the title of pdf in newly opened tab
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();
}
这篇关于如何在浏览器的新选项卡(_blank)中设置pdf文件打开的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文