---
schema_version: "1"
id: eab33107b4fa0a5a99c128740f5734698ea8f351a1684fc105c9fbd3ae76c1ec
title: Using Events between a Visualforce Page and a Canvas App
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/canvas-framework/guides/platform-connect/using/resizing-in-vf/canvas-vf-app-resizing.md
canonical_url: https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-vf-app-resizing.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: d80690e8a953fb11f7dc4582addd157d991de8e0772d484fe15629211319817b
products:
  - Canvas Developer Guide
  - Platform Developer Content
---

# Using Events between a Visualforce Page and a Canvas App

Canvas provides methods that you can use to publish and subscribe to events between your canvas app and the parent Visualforce page. This process includes publishing events from your Visualforce page, listening for events on your Visualforce page, unsubscribing from events on your Visualforce page, and resizing the Visualforce page that contains the canvas app. This process for resizing a canvas app differs from the process where the canvas app resizes itself, which is described in [Resizing a Canvas App](https://developer.salesforce.com/docs/platform/canvas-framework/resizing/canvas-app-resizing.md). Full reference documentation for these methods can be found in the [SDK](https://github.com/forcedotcom/salesforcecanvasframeworksdk) and [here](http://htmlpreview.github.io/?https://github.com/forcedotcom/SalesforceCanvasJavascriptSDK/blob/master/docs/index.html).

-   `publish`—Publishes an event from the Visualforce page that the canvas app can subscribe to. See [Publishing a Canvas Event from a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-publish-code-example.md).
-   `resize`—Used by a Visualforce page to resize a canvas app iFrame. See [Resizing a Canvas App in a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-resize-code-example.md).
-   `subscribe`—Used by a Visualforce page to subscribe to events that the canvas app might publish. See [Subscribing to Events](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-subscribe-code-example.md).
-   `unsubscribe`—Used by a Visualforce page to unsubscribe to parent events that the canvas app might publish. See [Unsubscribing from Events in a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-unsubscribe-code-example.md).

The [Controller.js](https://developer.salesforce.com/docs/platform/reference/controller-object.md#controller) object is needed for the Visualforce page to use these methods. Your script in the Visualforce page might look something like this:

```javascript
<script type="text/javascript"src="https://yourDomain.my.salesforce.com/canvas/sdk/js/30.0/controller.js">
```

**note:** You can use Lightning Platform methods to smoothly integrate navigation between a canvas app and the Salesforce mobile app, without using Visualforce. The methods are events that reside in the JavaScript library within the Canvas framework. When you call one of the navigation methods from your canvas code, you send an event into Salesforce that reads the payload and directs the user to the specified destination. For more information, see [Salesforce Mobile App Navigation Methods for Use with Canvas Apps](https://developer.salesforce.com/docs/platform/canvas-framework/chatter/canvas-apps-salesforce1-navigation-methods.md).

-   **[Publishing a Canvas Event from a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-publish-code-example.md)**  

-   **[Resizing a Canvas App in a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-resize-code-example.md)**  

-   **[Subscribing to Events](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-subscribe-code-example.md)**  

-   **[Unsubscribing from Events in a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-unsubscribe-code-example.md)**  


**See Also**  


-   [Publishing a Canvas Event from a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-publish-code-example.md)
-   [Resizing a Canvas App in a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-resize-code-example.md)
-   [Subscribing to Events](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-subscribe-code-example.md)
-   [Unsubscribing from Events in a Visualforce Page](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-vf-unsubscribe-code-example.md)
-   [apex:canvasApp Component](https://developer.salesforce.com/docs/platform/canvas-framework/canvas-app-vf-component-ref.md)

