I'm building a HTML5 game but if I set the game into fullscreen if my cursor on the top it shows that notification?
I use this to set it into fullscreen:
function toggleFullScreen() {
if (!document.fullscreenElement &&
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) {
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.msRequestFullscreen) {
document.documentElement.msRequestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
}
Thanks!
I'm building a HTML5 game but if I set the game into fullscreen if my cursor on the top it shows that notification?
I use this to set it into fullscreen:
function toggleFullScreen() {
if (!document.fullscreenElement &&
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) {
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.msRequestFullscreen) {
document.documentElement.msRequestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
}
Thanks!
Share Improve this question asked Jan 23, 2015 at 17:17 TamásTamás 1,1122 gold badges12 silver badges30 bronze badges3 Answers
Reset to default 6To the extent of my knowledge, this is not possible in javascript. The browser handles the showing of that notification to prevent websites from exploiting the user by going fullscreen without informing them, not showing them how to close it nor allowing them to.
Check out this answer for a bit more in-depth information: https://superuser./questions/398945/disable-the-youve-gone-full-screen-notification-in-chrome
Also: https://groups.google./a/webmproject/forum/#!topic/webm-discuss/5vtRCwu50ZU
I believe that, by design, it is not possible so that an application cannot takeover the screen for nefarious purposes.
No, you cant..it's one of the default functionality of a browser. it's one of the security features implemented in browsers..
See more here https://groups.google./a/webmproject/forum/#!topic/webm-discuss/5vtRCwu50ZU
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745392774a4625739.html
评论列表(0条)