@@ -144,23 +144,20 @@ function playground_text(playground) {
144144 . then ( response => {
145145 result_block . innerText = "" ;
146146 var iframe = result_block . appendChild ( document . createElement ( 'iframe' ) ) ,
147- doc = iframe . contentWindow . document ,
148- options = {
149- objid : 152 ,
150- key : 316541321
151- } ,
152- //src = "host/widget.js",
153- uri = encodeURIComponent ( JSON . stringify ( options ) ) ;
154- doc . someVar = "Hello World!" ;
155- iframe . id = "iframewidget" ;
156- iframe . width = result_block . width ;
157- iframe . height = result_block . height ;
158-
159- var html = '<body onload="var d=document;' +
160- 'var script=d.createElement(\'script\');script.type=\'module\';script.src=\'wasm-test.js\';' +
161- 'd.getElementsByTagName(\'head\')[0].appendChild(script);"><div id="button_click"></div></body>' ;
162- doc . open ( ) . write ( html ) ;
163- doc . close ( ) ;
147+ doc = iframe . contentWindow . document ;
148+ iframe . id = "wasm-rendering" ;
149+ iframe . style . width = "100%" ;
150+ iframe . style . height = "100%" ;
151+ var xhr = new XMLHttpRequest ( ) ;
152+ xhr . open ( 'GET' , 'iframe.html' , true ) ;
153+ xhr . onreadystatechange = function ( ) {
154+ if ( this . readyState !== 4 ) return ;
155+ if ( this . status !== 200 ) return ; // or whatever error handling you want
156+ var html = this . responseText ;
157+ doc . open ( ) . write ( html ) ;
158+ doc . close ( ) ;
159+ } ;
160+ xhr . send ( ) ;
164161 } )
165162 . catch ( error => result_block . innerText = "Playground Communication: " + error . message ) ;
166163
0 commit comments