# onBackButton

## Description

Triggers the back button to navigate to another page. This is applicable to android devices only.

## Input / Parameter

N/A

## Output

N/A

## Callback

### callback

The function to be executed when the back button is triggered to navigate to the page specified successfully.

## Video

Coming Soon.

## Example

The user wants to redirect to another page when they press the back button.

### Steps

| No. | Description                                                                                                                                                                                                       |                                                                                                                                                 |
| --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 1.  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-129cc9a82a5d7a806380aa9365316a93ea6ce3a4%2FonBackButton-step-1.png?alt=media) | Drag a button to a page in the mobile designer. Select the event `click` for the button and drag the `onBackButton` function to the event flow. |
| 2.  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-c5e726f57cadf8b0b8eefb745b9c32475e69e62d%2FonBackButton-step-2.png?alt=media) | Drag the function to be executed when the back button is triggered. In this example, we are using the `gotoPage` function.                      |
| 3.  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-593bdbafff46b1b6fb3457a98bf6945006e6dd0b%2FonBackButton-step-3.png?alt=media) | Select the page to navigate to.                                                                                                                 |

### Result

When the back button is pressed, the current page will redirect to pgWelcome.

## Links
