javascript - 取消或保存打印对话框后,当前窗口被挂起
问题描述
我创建大 HTML 页面(4 MB),然后调用window.print()
. 我想在用户关闭打印对话框后运行一些 JavaScript 代码。但afterprint
事件调用太晚(10-20 秒后)和页面挂起。Dom 包含大约 80 个SVG
由highcharts创建的元素,创建的 HTML 文件大小约为 4 MB。
// create html page dynamically
// run some code before print
window.onafterprint = function() {
// run some code after print
}
window.print();
解决方案
推荐阅读
- javafx - JavaFX 在同一应用程序中使用初始化控制器和 FXML 链接控制器
- java - 我无法将一个函数的值传递给 java 中的另一个函数。我怎样才能正确地做到这一点?
- python - 将文件从 /var/log/ 文件夹复制到主目录
- java - 我想将任何长度的字符串转换为固定的 32 字节
- nao-robot - 为 Pepper Robot 设置德语支持并安装 App Launcher
- javascript - 字符串拆分使用正则表达式开头 >=|<=|=|<|>|\!= 和一个字符串加上增量值
- database - Crystal Reports - 通过不同的中间表链接到表
- python - 循环变量可见性/范围
- android - 以编程方式跟踪android中的图像
- python - 夸脱 JSON 编码