我试图使用<embed />在网页上显示pdf,但我的代码之前运行良好,但现在它无法运行

时间:2015-07-20 06:29:02

标签: javascript

function pdfprint() {
    printFormat = window.open("","_blank","");
    printFormat.document.write("<html><head><title>Print </title>");
    printFormat.document.write("<script> \n");
    printFormat.document.write("function afterprint() { \n");
    printFormat.document.write("self.close();\n");
    printFormat.document.write("opener.<%=jspBean.FORM_PRINT_MEDIA%>.submit();\n");
    printFormat.document.write("} \n");
    printFormat.document.write("</");
    printFormat.document.write("script");
    printFormat.document.write(">");

    printFormat.document.write("</head><body onunload='afterprint()'><embed src='" + URL + "' width='100%' height='100%'></embed>");
    printFormat.document.write("<");
    printFormat.document.write("script>window.navigator.disablewincheck = true;print()");
    printFormat.document.write("</");
    printFormat.document.write("script");
    printFormat.document.write(">");
    printFormat.document.write("</body></html>");
    printFormat.document.close();
}

这里在上面的代码中,我给出了文件位于标签内的路径名,但它没有在浏览器上显示pdf文件(IE7),但在它运行良好之前

0 个答案:

没有答案