But if you want to send data to an iframe across domains, you need to be more clever. The trick is to use window.location.hash and the onhashchange event, then set the location of the iframe to have a different hash value (that includes your encoded data).

Let’s write some code that will encode arbitrary data (as long as it’s JSON encodable) and put it into the hash value of the desired iframe.

I’ve also created a tutorial to help people understand how to create
custom renderers with PhysicsJS. Better renderers are sorely needed to make PhysicsJS
even easier to use. I’m hoping some clever devs out there will be able to build
PhysicsJS renderers on top of great canvas libraries like
KineticJS, TWO.js, Pixi.js, Paper.js, or Easel.js.