Skip to content Skip to sidebar Skip to footer

How To Set Title For Pdf File Opening In New Tab (_blank) In Browser

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; w

Solution 1:

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();
        }

Post a Comment for "How To Set Title For Pdf File Opening In New Tab (_blank) In Browser"