Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

How can I track transition between fullscreen and normal modes in JS ?

A topic by titanplayers created Oct 16, 2023 Views: 104
Viewing posts 1 to 1

I need to know if a player goes to fullscreen mode or back in my HTML5 game. For an example:

        document.addEventListener("fullscreenchange", function () {
            console.log('fullscreen change!');
        });

The code above falls with an error message:

Uncaught (in promise) DOMException: Operation is not supported    request_fullscreen https://static.itch.io/bundle.min.js?1697477578:1
    enter_fullscreen https://static.itch.io/game.min.js?1697477578:1
    fullscreen_btn https://static.itch.io/game.min.js?1697477578:1
    dispatch https://static.itch.io/bundle.min.js?1697477578:1
    dispatch https://static.itch.io/lib.min.js?1697477578:2
    handle https://static.itch.io/lib.min.js?1697477578:2
This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.