打开用于打印的选项卡永久显示“加载”图标

时间:2011-11-22 16:16:50

标签: javascript gwt

我的GWT JavaScript应用程序打印报告,方法是以编程方式打开一个新的浏览器窗口,填写我要打印的报告,然后调用window.print:

native void openPrintWindow(String contents) /*-{
    var printWindow = window.open("", "PrintWin");
    if (printWindow && printWindow.top) {
        printWindow.document.write("<html><head><title>Report Card Print Window</title></head><body>");
        printWindow.document.write(contents);
        printWindow.document.write("</body></html>");
        printWindow.print();
    } else {
        alert("The print feature works by opening a popup window, but our popup window was blocked by your browser.  If you can disable the blocker temporarily, you'll be able to print here.  Sorry!");
    }
}-*/;

这很有效,除了标题栏中的图标永远不会改变其最初的旋转加载图标。如何让它意识到它已经完成加载?

我认为问题在于它实际上并没有下载任何东西,所以它永远不会“完成”。有什么我可以称之为document.finalize或其他任何东西吗?

1 个答案:

答案 0 :(得分:3)

是的,您需要在上一次document.close()来电后致电document.write

https://developer.mozilla.org/en/document.write#Notes