You are here: Reference > JavaScript > client-side > browser > properties > fullScreen (window)

fullScreen property (window)

Browser support:
3
Specifies or retrieves whether the browser application is in full-screen mode or not.
Note: The fullScreen property works in Firefox from version 3, in earlier versions it always returns false.
To write the fullScreen property, the UniversalXPConnect privilege is required. See Example 2 for details.
In Microsoft Windows platforms, the F11 key toggles the browser applications (Internet Explorer, Firefox, Google Chrome and Opera, but not Safari) between full screen and normal mode.

Syntax:

object.fullScreen;
You can find the related objects in the Supported by objects section below.
This property is read/write.

Possible values:

Boolean that specifies or retrieves whether the browser application is in full-screen mode.
One of the following values:
false
The browser application isn't in full-screen mode.
true
The browser application is in full-screen mode.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the fullScreen property:
<head>
    <script type="text/javascript">
        function IsInFullScreenMode () {
            alert (window.fullScreen);
        }
    </script> 
</head>
<body>
    <button onclick="IsInFullScreenMode ();">Is in full screen mode?</button>
    Press F11 to toggle between normal and full screen mode.
</body>
Did you find this example helpful? yes no

Example HTML code 2:

This example shows how to toggle between the normal and the full screen mode write with the fullScreen property:
<head>
    <script type="text/javascript">
        function ToggleFullScreen () {
                // UniversalXPConnect privilege is required in Firefox
            try {
                if (window.netscape && netscape.security) { // Firefox
                    netscape.security.PrivilegeManager.enablePrivilege ("UniversalXPConnect");
                }
            }
            catch (e) {
                alert ("UniversalXPConnect privilege is required for this operation!");
                return;
            }

            if ('fullScreen' in window) {
                window.fullScreen = !window.fullScreen;
            }
            else {
                alert ("Your browser does not support this example!");
            }
        }
    </script> 
</head>
<body>
    Press this button, 
    <button onclick="ToggleFullScreen ();">Change full screen mode!</button>
    or press F11 to toggle between normal and full screen mode.
</body>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content