> For the complete documentation index, see [llms.txt](https://docs.webtonative.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.webtonative.com/javascript-apis/disable-back-button-android-and-ios.md).

# Disable Back Button API

Control the default back button of the phone, blocking the user from going back in the app. For iOS, you can now disable the swipe gesture to go back.

{% hint style="info" %}
You'll need to import the JavaScript file into your website before starting from this [link](https://docs.webtonative.com/javascript-apis/getting-started).
{% endhint %}

{% tabs %}
{% tab title="Plain Javascript" %}

```
window.WTN.customBackHandling({
    enable:true/false
})
```

{% endtab %}

{% tab title="npm" %}

```
import { customBackHandling } from "webtonative"

customBackHandling({
    enable:true/false
})
```

{% endtab %}
{% endtabs %}

enable (Boolean parameter) - Passing this true will disable the back button/swipe gesture.

`customBackHandling` this function on the window will be called where you can handle the back functionality.\
`Example:-`\
`windows.customBackHandling = function(){`\
&#x20;   `//Handle your logic` \
`}`

Feature added in Android on 27/06/25

Feature added in iOS on 04/09/25
