Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在用户控件上有一个 iframe。我需要打印动态加载到 iframe 上的网页。我能够做到这一点。但我无法确定用户是否实际打印过。 我在 iframe 的网页中调用了 javascript 函数 print()。 当显示打印对话框时,我需要知道用户是否选择了确定(打印)或取消并将其传递回用户控件。 关于如何做到这一点的任何想法。
提前致谢。
这是不可能的。如果打印已完成或取消,浏览器将不会通知您。
您可以onafterprint在一定程度上使用事件,但这仅在 FF 和 IE 上受支持。例如,在 IE 10 上,甚至在打开打印对话框之前触发事件。
onafterprint
https://developer.mozilla.org/en-US/docs/Printing