簡體   English   中英

Window.print() 函數和 document.execCommand('print') 函數在 MS Edge 中不起作用

[英]Window.print() function and document.execCommand('print') fucntion is not working in MS Edge

我正在嘗試使用 window.print() 函數在我的應用程序中打印 html 報告,在所有瀏覽器中運行良好,但在 Microsoft Edge 中沒有任何反應。

在 Microsoft Edge 中打印的任何替代功能?

我嘗試了函數 - document.execCommand('print')。 在 chrome 中對此進行了測試,在那里運行良好,但在 MS Edge 中不起作用。

請檢查您的 Microsoft Edge 瀏覽器版本,window.print() 方法和 document.execCommand("print") 腳本在我這邊運行良好(使用 Microsoft Edge 44.18362.1.0),結果如下: 在此處輸入圖片說明

示例代碼:

<button onclick="myFunction()">Print this page</button>

<script>
    function myFunction() {
        //window.print();
        document.execCommand("print");
    }
</script>

因此,您可以嘗試將 Microsoft Edge 瀏覽器版本升級到版本 44.18362.1.0 或最新版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM