[英]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.