cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

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

Janakiraman
10-Marble

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.

 

ACCEPTED SOLUTION

Accepted Solutions

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)

 

View solution in original post

5 REPLIES 5

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)

 

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?

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

What if keyboard is not available ???

Keyboard on screen :P

Announcements

Top Tags