# Accelerometer events in HTML Application

**URL:** <https://forum.defold.com/t/accelerometer-events-in-html-application/3848>\
**Category:** Questions\
**Created:** [January 2, 2017, 3:13pm UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848 "2017-01-02T15:13:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![eviee89](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/e/59ef9b/32.png) [@eviee89](https://forum.defold.com/u/eviee89)\
**Post date:** [January 2, 2017, 3:13pm UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/1 "2017-01-02T15:13:33Z")

</div>

Is there a way to get accelerometer data on HTML5 Application? I can get it through on\_input method on Android build, but when i try to get it through browsers on my mobile device it returns nil… Or if not is there any way to access data from window “devicemotion” event listener or something similar?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 2, 2017, 9:20pm UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/2 "2017-01-02T21:20:52Z")

</div>

Accelerometer data is currently only available on Android and iOS builds if I recall correctly. Are you planning to run a Defold HTML5 export on a mobile device?

---

<div class="post-metadata">

**Author:** ![eviee89](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/e/59ef9b/32.png) [@eviee89](https://forum.defold.com/u/eviee89)\
**Post date:** [January 3, 2017, 7:35am UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/3 "2017-01-03T07:35:06Z")

</div>

Thanks for the reply 🙂 The plan is to have html5 browser game and if the game is opened on mobile device browser it should have access to accelerometer…

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [January 3, 2017, 9:09am UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/4 "2017-01-03T09:09:29Z")

</div>

I see. What kind of game is it? Depending on the game and the hardware it is running on you shouldn’t really expect brilliant performance from an HTML5 build of the game when tested on a mobile or tablet. The Defold HTML5 builds can be expected to perform well on standard PC hardware on a modern browser though. I would recommend that you detect if the user is trying your game from a mobile browser and in that case redirect them to the relevant app store.

---

<div class="post-metadata">

**Author:** ![eviee89](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/e/59ef9b/32.png) [@eviee89](https://forum.defold.com/u/eviee89)\
**Post date:** [January 3, 2017, 9:35am UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/5 "2017-01-03T09:35:07Z")

</div>

Ok, i hoped that it can be achieved but you’re right performance may not be so great. I will do apps for mobile devices. Thanks 🙂

---

<div class="post-metadata">

**Author:** ![SpencerWF](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/spencerwf/32/21158_2.png) [@SpencerWF](https://forum.defold.com/u/SpencerWF)\
**Post date:** [April 21, 2020, 11:20am UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/6 "2020-04-21T11:20:07Z")

</div>

@britzl is this still your perspective on the use of the accelerometer on HTML5 builds of Defold games?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 21, 2020, 2:24pm UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/7 "2020-04-21T14:24:48Z")

</div>

> [@britzl](#):
>
> Depending on the game and the hardware it is running on you shouldn’t really expect brilliant performance from an HTML5 build of the game when tested on a mobile or tablet.

> [@SpencerWF](#):
>
> is this still your perspective on the use of the accelerometer on HTML5 builds of Defold games?

No, a lot has changed since that post was made in 2017. Defold has become faster, and so has the phones people have. Defold works really well on mobile phones in 2020.

---

<div class="post-metadata">

**Author:** ![Sanuk\_games](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sanuk_games/32/38017_2.png) [@Sanuk\_games](https://forum.defold.com/u/Sanuk_games)\
**Post date:** [November 28, 2024, 11:35am UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/8 "2024-11-28T11:35:46Z")

</div>

@britzl  
Hi,

Does the accelerometer support HTML5 now?  
If it is support where can I find more detail or examples?

Thank you.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [November 28, 2024, 1:02pm UTC](https://forum.defold.com/t/accelerometer-events-in-html-application/3848/9 "2024-11-28T13:02:03Z")

</div>

> [@Sanuk\_games](#):
>
> Does the accelerometer support HTML5 now?

No, it is not something we have focused on.
