Skip to main content
Dec 14, 2018 12:47 PM UTC
Solved

How to enable/disable Full Screen(F11) mode by clicking a Button?

Hi There,

 

I was trying to enable full-screen mode by clicking a button instead of f11 option.

I used the following HTML code as a normal HTML file, works cool.

 

<button  onclick='document.documentElement.webkitRequestFullscreen();'>Go Fullscreen Mode</button><button onclick='document.webkitExitFullscreen();'>Close Fullscreen</button>

 

I also tried HtmlTextArea widget with the read-only option enabled, Not getting the expected result.

Even I tried WebFrame widget to call the HTML file and execute, not worked.

 

Give me a solution if exist.

 

Dec 17, 2018 9:03 AM UTC

Add an Expression widget and on the expression field set:

 

($("#runtime")[0].webkitRequestFullScreen()?$("#runtime")[0].webkitRequestFullScreen():($("#runtime")[0].mozRequestFullScreen()?$("#runtime")[0].mozRequestFullScreen():$("#runtime")[0].msRequestFullscreen()?$("#runtime")[0].msRequestFullscreen():$("#runtime")[0].requestFullScreen()))

Then when you want full screen you just need to trigger this expression (from a button Click event, should be started by a user clicking the button)

 

5 replies

Dec 17, 2018 9:03 AM UTC

Add an Expression widget and on the expression field set:

 

($("#runtime")[0].webkitRequestFullScreen()?$("#runtime")[0].webkitRequestFullScreen():($("#runtime")[0].mozRequestFullScreen()?$("#runtime")[0].mozRequestFullScreen():$("#runtime")[0].msRequestFullscreen()?$("#runtime")[0].msRequestFullscreen():$("#runtime")[0].requestFullScreen()))

Then when you want full screen you just need to trigger this expression (from a button Click event, should be started by a user clicking the button)

 

Dec 17, 2018 10:15 AM UTC

Hi,

 

Works for FullScreen!

 

I tried the following combinations two ExitFull Screen, Not Working..,

 

($("#runtime")[0].webkitExitFullscreen()?$("#runtime")[0].webkitExitFullscreen():($("#runtime")
[0].mozCancelFullScreen()?$("#runtime")[0].mozCancelFullScreen():$("#runtime")[0].msExitFullscreen()?$("#runtime")[0].msExitFullscreen():$("#runtime")[0].exitFullscreen()))

 

($("#runtime")[1].webkitExitFullscreen()?$("#runtime")[1].webkitExitFullscreen():($("#runtime")
[1].mozCancelFullScreen()?$("#runtime")[1].mozCancelFullScreen():$("#runtime")[1].msExitFullscreen()?$("#runtime")[1].msExitFullscreen():$("#runtime")[1].exitFullscreen()))

 

How I exit the FullScreen?

Dec 17, 2018 10:16 AM UTC

You can't control exiting full screen from within the page, should be the user with "ESC" keyboard key.