Ok, here is the setup:

  • I've a Canvas App with a select in it;
  • I've a Visualforce page with a selectList element filled with the same options as the select in the Canvas App, and a canvasApp element that points to the previously mentioned Canvas App.

Now I need to be able to synchronize the contents of the selectList with the select.
From everything I've read and experimented I'm concluding that the only way to do this is by using a somewhat messy javascript. So I was just wondering if anyone out there has a better idea on how to do this.


  • 1
    Well a sneaky way would be to pass it down to the Canvas app as a Param... – joshbirk Feb 27 '13 at 18:46
  • I guess that by refreshing the whole canvas app I could keep it synchronized, but what about the other way around? How do you suggest that I keep the visualforce selectList synchronized with the select inside the canvas app? ... Again, keeping it simple. – ricardomartins Mar 1 '13 at 12:26
  • Canvas talks to Salesforce by sending messages to the window, and then having those messages proxied back to the API's. So you would need to do it via REST somehow. Custom Apex endpoint, perhaps. – joshbirk Mar 1 '13 at 17:25

I'm going to point you here:


I've just implemented it myself with a Canvas app and it works fine.

window.addEventListener('message', receiveMessage, false);

function receiveMessage(evt)
  if (evt.origin === 'https://my.cavasapp.com')
     //Code to process message and sync select box here.
     //alert("got message: "+evt.data);

Note the browser limitations here (IE won't allow a JSON object it seems): http://caniuse.com/x-doc-messaging


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.