$("#print").on('click', function () {
var child = window.open("image.jpg", "_blank", "location=0,toolbar=0,scrollbars=1,fullscreen=1,menubar=0");
//any way to know/wait for image to load?
child.print();
});
在调用 .print() 之前,我的父窗口有什么方法可以知道子窗口已完成加载图像?如果他们很高兴,他们最终会打印一个空白页。
我都试过了:
child.attachEvent("onload", function () { child.print(); });
和
child.attachEvent("DOMContentLoaded", function () { child.print(); });
//(found this online, apparently it's Firefox only, still didn't work)