Jump to content

set and cancel fullsreen mode in mobile.


rossi46
 Share

Recommended Posts

i use V 4.5. I create a button in my game. When i click button I want to my game full screen in mobile. But when i click button, my  console say : "Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture."

that.btnSpin.on("pointerover", that.btnOver).on("pointerout", that.btnOut).on("pointerdown", that.btnSpinDown).on("touchstart", checkFullScreen).on("click", checkFullScreen).on("mousedown", checkFullScreen).on("tab", checkFullScreen);


var checkFullScreen = function () {
			document.documentElement.requestFullscreen ? document.documentElement.requestFullscreen() : document.documentElement.msRequestFullscreen ? document.documentElement.msRequestFullscreen() : document.documentElement.mozRequestFullScreen ? document.documentElement.mozRequestFullScreen() : document.documentElement.webkitRequestFullscreen && document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);

 

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...