BeginnerSoul's avatar

Fullscreen

Hello How I can make the laravel website in webbrowser fullscreen? What I have fullscreen function, it works in normal HTML format however if I want to use in laravel then the website is trying to be fullscreen but halfway it wants updating itself and therefore will not become fullscreen. The code which I found on the internet javascript:

function toggleFullScreen() {
    if ((document.fullScreenElement && document.fullScreenElement !== null) ||
        (!document.mozFullScreen && !document.webkitIsFullScreen)) {
        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();
        }
    }
}

I read also even if I success to function this code, the webpage will not staying in fullscreen if I click to different menu. Is there a method to make possible that the whole webpage can be viewed in fullscreen?

Thank you in advance the answers.

0 likes
4 replies
jlrdw's avatar

A laravel app should be full screen anyway without that JavaScript. Perhaps explain in more detail what is going on, and what you were trying to do.

Is this only a mobile problem, or desktop.

furqanDev's avatar
Level 18

PHP by itself has no state. It is stateless. Each request is completely unique. When you make a request the page refresh and state is lost. In order to achieve this you can convert your application to SPA(Single Page Application) app. But If you want to achieve this then you need to trigger this function on page load so that after the page load the screen will be set to full size.

BeginnerSoul's avatar

@furqanDev Oh I see. So I need to make SPA or iframe but better to make SPA in this case with vue. Thank you for the answer.

Please or to participate in this conversation.