# Detecting long press of Back key

**URL:** <https://forum.webostv.developer.lge.com/t/detecting-long-press-of-back-key/23304>\
**Category:** Web App Development\
**Created:** [February 23, 2025, 10:51pm UTC](https://forum.webostv.developer.lge.com/t/detecting-long-press-of-back-key/23304 "2025-02-23T22:51:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aida\_Ban](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@Aida\_Ban](https://forum.webostv.developer.lge.com/u/Aida_Ban)\
**Post date:** [February 23, 2025, 10:51pm UTC](https://forum.webostv.developer.lge.com/t/detecting-long-press-of-back-key/23304/1 "2025-02-23T22:51:04Z")

</div>

I’m trying to detect when the Back key is long-pressed. However, using `window.addEventListener("keydown", ...)` doesn’t work because the event only fires when the key is released, at the same time as the `keyup` event. For other keys, the `keydown` and `keyup` events fire as expected.

Is there another way to specifically detect a long press of the Back key?

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [February 25, 2025, 8:30am UTC](https://forum.webostv.developer.lge.com/t/detecting-long-press-of-back-key/23304/2 "2025-02-25T08:30:46Z")

</div>

Please set the disableBackHistoryAPI property to true in the appinfo.json and try again. You can refer to [Handling a back button event](https://webostv.developer.lge.com/develop/guides/back-button#handling-a-back-button-event). Thank you.

---

<div class="post-metadata">

**Author:** ![Aida\_Ban](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@Aida\_Ban](https://forum.webostv.developer.lge.com/u/Aida_Ban)\
**Post date:** [February 25, 2025, 11:26pm UTC](https://forum.webostv.developer.lge.com/t/detecting-long-press-of-back-key/23304/3 "2025-02-25T23:26:28Z")

</div>

`disableBackHistoryAPI` is already set to true. I am able to detect if the **Back** key was pressed, but I cannot differentiate between **single-press** and **long-press**.

---

<div class="post-metadata">

**Author:** ![narae0.kim](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@narae0.kim](https://forum.webostv.developer.lge.com/u/narae0.kim)\
**Post date:** [March 6, 2025, 5:05am UTC](https://forum.webostv.developer.lge.com/t/detecting-long-press-of-back-key/23304/4 "2025-03-06T05:05:45Z")

</div>

Sorry for the late reply. As you mentioned, the back key press event is sent when released. And this is the TV specification. Basically, long pressing the back key is designed to exit the app and take you to Home. Therefore, the app doesn’t need to check the press type. For your information, the default long press action for the back key is:  
Magic Remote Control Unit: Exit to Home.  
Conventional Remote Control Unit:

- webOS 25: Exit to Home.
- webOS 24 and earlier: None.
