I have a canvas app embedded using a Visualforce page.

From within this canvas application, I would like to the user to be able to navigate back to the contact in salesforce.

Using the URLs directly do not work (nor does parent.location) because canvas apps are located in an iframe and the domains are different.

I found lots of information about doing this in salesforce1, but my understanding is that that is for mobile applications.

(For example: https://developer.salesforce.com/docs/atlas.en-us.186.0.salesforce1.meta/salesforce1/vf_dev_best_practices_navigation.htm)

These examples reference a javascript library sforce.one which I'm assuming is the mobile javascript library. The library I'm using looks like this: Sfdc.canvas.client.

Is there a way I can create a link that will go back to the application using regular salesforce? Something like this: https://na22.salesforce.com/0031500001aVOD to go to the contact identified by "0031500001aVOD"

1 Answer 1


We had a similar situation when we need to close the canvas page after performing operation and reload the parent page.

For that we used events which can be called from the external application side.I am sharing a sample code of that.

There will be 2 events.

  • Subscribe
  • Publish

One event will be on visualforce side and other will be on external app side.

In my scenario the subscribe event is on visualforce side.

 <script type="text/javascript"src="/canvas/sdk/js/30.0/controller.js">

            name : 'mynamespace.apiNavigation',
            onData : function (payload) {

And the corresponding publish event which the above subscribe event subscribes is like this(This is on external app side.)

Sfdc.canvas(function() {
    sr = JSON.parse('<%=signedRequestJson%>');
        name : "mynamespace.apiNavigation", 
        payload : {status : 'Completed'}
  • So on the external application side, I added that code and then discovered that you needed to include a controller.js file to reference Sfdc.canvas.controller. After adding that, I can now reference the controller but it complains about Sfcd.canvas.parent being undefined when trying to subscribe: Sfdc.canvas.parent.subscribe(event). Would you have any idea why it can't reference the parent? And I really appreciate your help. Jun 3, 2016 at 17:32
  • i have updated the answer.
    – Mr.Frodo
    Jun 4, 2016 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .