File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
+ < title > aegewg</ title >
7
+ </ head >
8
+ < body >
9
+
10
+ < input type ="text " id ="url " placeholder ="url ">
11
+ < button id ="post "> post msg</ button >
12
+
13
+ < script >
14
+
15
+ const post = document . getElementById ( 'post' ) ;
16
+ const url = document . getElementById ( 'url' ) ;
17
+
18
+ const gaga = document . createElement ( 'iframe' ) ;
19
+ gaga . src = "./iframereceivetest.html" ;
20
+ gaga . width = 600 ;
21
+ gaga . height = 500 ;
22
+ document . body . appendChild ( gaga ) ;
23
+
24
+ url . onchange = ( ) => {
25
+ gaga . src = url . value ;
26
+ } ;
27
+
28
+ post . onclick = ( ) => {
29
+ gaga . contentWindow . postMessage ( {
30
+ joe : 'oh my goodnees'
31
+ } , "*" ) ;
32
+ } ;
33
+
34
+ </ script >
35
+
36
+ </ body >
37
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
+ < title > Document</ title >
7
+ </ head >
8
+ < body >
9
+
10
+
11
+ < script >
12
+
13
+ window . onmessage = ( e ) => {
14
+ const element = document . createElement ( 'p' ) ;
15
+ element . innerText = `${ JSON . stringify ( e . data ) } ` ;
16
+ document . body . appendChild ( element ) ;
17
+ } ;
18
+
19
+ </ script >
20
+
21
+ </ body >
22
+ </ html >
You can’t perform that action at this time.
0 commit comments