# Sys.exit() freez game on HTML5

**URL:** <https://forum.defold.com/t/sys-exit-freez-game-on-html5/75603>\
**Category:** Bugs\
**Created:** [January 8, 2024, 6:05am UTC](https://forum.defold.com/t/sys-exit-freez-game-on-html5/75603 "2024-01-08T06:05:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thawri](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/thawri/32/24046_2.png) [@thawri](https://forum.defold.com/u/thawri)\
**Post date:** [January 8, 2024, 6:05am UTC](https://forum.defold.com/t/sys-exit-freez-game-on-html5/75603/1 "2024-01-08T06:05:58Z")

</div>

clicking the exit button call sys.exit(0).  
it works on desktop and android. but on Html5 it freezes the game and does not exit.  
I thought it was not that important but my game was rejected by Yandex because of this issue.  
you can check it in this repo:  
[https://github.com/thawri1/DefoldFullScreenIssue](https://github.com/thawri1/DefoldFullScreenIssue)

---

<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 8, 2024, 7:46am UTC](https://forum.defold.com/t/sys-exit-freez-game-on-html5/75603/2 "2024-01-08T07:46:31Z")

</div>

> [@thawri](#):
>
> it works on desktop and android. but on Html5 it freezes the game and does not exit.

You can use sys.exit() on html5 as well, but it depends on what you expect will happen when you press it? It will not shut down the browser tab/page or anything like that.

---

<div class="post-metadata">

**Author:** ![thawri](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/thawri/32/24046_2.png) [@thawri](https://forum.defold.com/u/thawri)\
**Post date:** [January 8, 2024, 7:54am UTC](https://forum.defold.com/t/sys-exit-freez-game-on-html5/75603/3 "2024-01-08T07:54:05Z")

</div>

so what do sys.exit in Html?  
is there any way to close the tab in code by defold-lua?  
or it is pointless to put the exit button in HTML games?

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [January 8, 2024, 8:05am UTC](https://forum.defold.com/t/sys-exit-freez-game-on-html5/75603/4 "2024-01-08T08:05:39Z")

</div>

HTML5 games shouldn’t have anything like “exit” option. So you can just check

```lua
if html5 then
    hide_my_exit_button()
end

```
