Forum

Request fullscreen with keyboard key

07 October 2017 22:58
I would like when I press a keyboard key to switch in fullscreen.
But when I try I have this message :

"Failed to execute 'requestFullscreen" on "Element": API can only be initiated by a user gesture.

I don't understand why it's not possible.

Perhaps in an future version of Blend4Web ?

Otherwise, thanks for the great work you do
12 October 2017 14:49
Hi, how do you execute the code, which should perform switching? The error message is not a blend4web specific thing. It's a common js security measure to prevent such actions from happening without user participation.

This should work inside an event handler, e.g:
document.addEventListener("click", function(e) {
    // switch to fullscreen
})
 
Please register or log in to leave a reply.