Pass a Javascript Object to an HTML iframe (as an Object) -


i'm not sure of way this, have html page mainwindow , have iframe childwindow.

i need mainwindow create javascript object childwindow can utilize.

my mainwindow.html looks @ moment

<html>  <style>     body { background-color:#333333; } </style>  <body>  <script>      var varobject = {type:"error", message:"lots"};      console.log(         "(main window) " + varobject.type + " : " + varobject.message     );  </script>  <iframe class="child" src="childwindow.html"></iframe>  </body> </html> 

the childwindow.html looks this

<html>  <style>     body { background-color:#666666; } </style>  <body>  <script>      console.log(         "(main window) " + varobject.type + " : " + varobject.message     );  </script>  </body> </html> 

the childwindow trying use object created in mainwindow of course can't because don't yet know how pass it.

i've tried google of solutions found involved passing values strings instead of variable.

you should use window.postmessage send messages , iframes embedded in site.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -