---
schema_version: "1"
id: 2a8699233f58d15ac3365c3a56e3a9beac233dbbe667f35d0fe70581251ee00b
title: Handling Orientation Changes in Your 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/canvas-app-orientation-code-example.md
canonical_url: https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-orientation-code-example.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: afc4bf4766bcc40a028296801b0b36c455c18b3bc30d9612549e4d1004a22332
products:
  - Canvas Developer Guide
  - Platform Developer Content
---

# Handling Orientation Changes in Your Canvas App

The `orientation` event enables you to handle changes in orientation when your canvas app appears on a mobile device. After your canvas app subscribes to the event, the event fires whenever the parent window fires a `window.orientation` event. The event returns a payload that contains these values.

|Value|Description|
|-----|-----------|
|`clientHeight`|The height of the app in pixels, specific to the device on which the canvas app renders|
|`clientWidth`|The width of the canvas app in pixels, specific to the device on which the canvas app renders|
|`orientation`|Contains one of these values.<ul><li>0: landscape to portrait</li><li>90: portrait to landscape</li><li>-90: portrait to landscape turned counterclockwise</li></ul>|

The following code example shows how to subscribe to the `orientation` event.

<!-- otherprops: set_clipboard -->
```java
// Capture the orientation event of the parent window.
Sfdc.canvas.client.subscribe(sr.client,
    {name : 'canvas.orientation', 
    onData : function (event) {
        console.log("Parent's orientation: " + event.orientation +
                    "Canvas app height: " + event.clientHeight +
                    "Canvas app width: " + event. clientWidth);
        }} );
});

```

**note:** The `orientation` event isn’t supported on Windows phones.

**See Also**  


-   [Resizing a Canvas App](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-resizing.md)
-   [Subscribing to Parent Events](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-subscribe-code-example.md)

