Hello

I want to create a button that when the user clicks on it, the browser goes automatically fullscreen. It would be for mainly IE9 and I use for the rest of the browsers the HTML5 fullscreen API.

Thanks

Recommended Answers

All 8 Replies

Member Avatar for stbuchok

http://www.sitepoint.com/html5-full-screen-api/

So probably something like this (using jQuery):

$('#buttonId').click(function(){
    document.requestFullScreen();
});

Someone please correct me if I'm wrong, but fullscreen mode does not support keyboard, just in case you didn't know.

Like I mentioned this is for IE9. For FF, Chrome, etc. Im using that HTML 5 full screen API (which works so so; Tried it on a older version of Firefox and did not work)

Also it would be a button; Nothing automatic.

Member Avatar for stbuchok

Without using HTML5 or something like Flash or Silverlight, I don't believe it is possible.

Without using HTML5 or something like Flash or Silverlight, I don't believe it is possible.

Nothing for IE9?

The exiting fullscreen doesnt work.

My two functions:

<script type="text/javascript">
function max()
{
    var docElm = document.documentElement;
        if (docElm.requestFullscreen) 
        {
            docElm.requestFullscreen();
        }
        else if (docElm.mozRequestFullScreen) 
        {
            docElm.mozRequestFullScreen();
        }
        else if (docElm.webkitRequestFullScreen) 
        {
            docElm.webkitRequestFullScreen();
        } 
        else if (docElm.msRequestFullScreen) 
        {
            docElm.msRequestFullScreen();
        } 
        else if (docElm.oRequestFullScreen) 
        {
            docElm.oRequestFullScreen();
        } 
        else
        {
            alert("I am 12 and what is this?");
        }
}

function min()
{

        if (document.fullScreen) 
        {
            document.cancelFullScreen();
        }
        else if (document.fullScreen) 
        {
            document.mozCancelFullScreen();
        }
        else if (document.fullScreen) 
        {
            document.webkitCancelFullScreen()
        }
        else if (document.fullScreen) 
        {
            document.msCancelFullScreen();
        } 
        else if (document.fullScreen) 
        {
            document.oCancelFullScreen();
        }  
        else
        {
            alert("I am 12 and what is this?");
        }
}





</script>

Unless Im missing something. Testing this in latest stable version of Firefox.

Hello

I want to create a button that when the user clicks on it, the browser goes automatically fullscreen. It would be for mainly IE9 and I use for the rest of the browsers the HTML5 fullscreen API.

On Win8 you are already on full-screen mode

@TroyIII Yes but thats IE10.

Member Avatar for diafol

I don't think IE9 can be made to do this, and unfortunately, F11 keypress can't be called programatically.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.