2015-01-29 3 views
3

웹 응용 프로그램에 전체 화면 모드로 작업 할 수있는 버튼이 있습니다. 내 문제는 현재 페이지에서만 작동한다는 것입니다. 링크를 클릭하거나 다른 방법으로 페이지를 변경하거나 현재 화면을 새로 고침해도 전체 화면 모드가 손실됩니다.페이지를 변경하거나 새로 고침 할 때 전체 화면이 표시되지 않습니다.

이있다 나는 전체 화면 수 있도록 사용하고 기능 :

// Handle full screen mode toggle 
var handleFullScreenMode = function() { 
    // toggle full screen 
    function toggleFullScreen() { 
    if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement) { // current working methods 
     if (document.documentElement.requestFullscreen) { 
     document.documentElement.requestFullscreen(); 
     } else if (document.documentElement.mozRequestFullScreen) { 
     document.documentElement.mozRequestFullScreen(); 
     } else if (document.documentElement.webkitRequestFullscreen) { 
     document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); 
     } 
    } else { 
     if (document.cancelFullScreen) { 
     document.cancelFullScreen(); 
     } else if (document.mozCancelFullScreen) { 
     document.mozCancelFullScreen(); 
     } else if (document.webkitCancelFullScreen) { 
     document.webkitCancelFullScreen(); 
     } 
    } 
    } 

    $('#trigger_fullscreen').click(function() { 
    toggleFullScreen(); 
    }); 
} 

$(document).ready(function() { 
    handleFullScreenMode(); 
}); 

당신이 F11를 클릭 할 때 발생하는 등의 페이지를 변경할 때 그것을 유지 어쨌든 거기를?

+0

페이지 자체가 새로 고침됩니까? js를하지 않고보기에 머물러 있지 않습니까? –

+0

페이지 리로드를 통해 쿠키 또는 localStorage/sessionStorage에 값을 저장하고 전체 화면 기능을 다시 적용하여 전체 화면 모드의 상태를 유지할 수 있습니다. – hindmost

+0

@hindmost으로 특정 수준까지만 작동하지만 전체 화면 기능을 제거하는 것이 창의 크기를 항상 변경하는 것보다 더 좋습니다. 조금 실망스럽고 좌절감은 사용자가 내 응용 프로그램을 사용할 때 느껴지 길 바라는 것이 아닙니다. – FabioG

답변

4

불행히도.

API specifies 전체 화면은 현재 또는 내림차순 브라우저 컨텍스트에서만 작동합니다.

페이지가 변경되거나 새로 고쳐지면 브라우저 컨텍스트가 변경되고 전체 화면 효과가 손실됩니다. 함께

MDN also reinforces :

... 탭을 변경하거나, 다른 프로그램으로의 전환, 다른 페이지로 이동 (예를 들어, 사용 Alt 키 탭) 화면 모드에있는 동안은 물론 화면 모드를 종료한다.

+0

그것은 유감이지만 네 말이 맞다. – FabioG