質問編集履歴

1

情報追記

2023/03/31 09:43

投稿

muteki_gamer
muteki_gamer

スコア157

test CHANGED
File without changes
test CHANGED
@@ -39,3 +39,16 @@
39
39
  ```
40
40
  色々試してみましたが、お手上げ状態です。
41
41
  srcが指定ありと指定なしで動作の違いがあることが全く分かりません。
42
+
43
+ **追記**
44
+ 入れ替えても動きませんでした。
45
+ ```
46
+ if (iframe.contentWindow) {
47
+ iframe.contentWindow.onafterprint = function () {
48
+ console.log("Print completed.");
49
+ document.body.removeChild(iframe);
50
+ };
51
+ iframe.contentWindow.print();
52
+ }
53
+ ```
54
+