首页 > 解决方案 > 取消或保存打印对话框后,当前窗口被挂起

问题描述

我创建大 HTML 页面(4 MB),然后调用window.print(). 我想在用户关闭打印对话框后运行一些 JavaScript 代码。但afterprint事件调用太晚(10-20 秒后)和页面挂起。Dom 包含大约 80 个SVGhighcharts创建的元素,创建的 HTML 文件大小约为 4 MB。

// create html page dynamically
// run some code before print
window.onafterprint = function() {
    // run some code after print
}
window.print();

标签: javascripthtmlhighchartsdom-eventsfreeze

解决方案


推荐阅读