FullScreen API - Mozilla

You can display an element in the fullscreen mode. If the element uses the :full-screen CSS pseudo-class to switch to the fullscreen mode, a style can be assigned for the fullscreen mode.

This feature is supported in mobile and TV applications only.

To switch to the fullscreen and back:

  • With the webkitRequestFullScreen() method, you can convert a specific element to fullscreen.
  • With the webkitCancelFullScreen() method, you can cancel the fullscreen mode.

Tizen supports the WebKit-based Fullscreen API. When using the Fullscreen API, you must include the webkit prefix.

Using the Fullscreen Mode

To display and element on full screen, you must learn to use the fullscreen mode:

  1. Define the element to be shown in the fullscreen mode.

    In the following example, the screen contains an image, a video playback area, and 2 buttons. For the fullscreen mode, the image and 1 button are defined as an element (fs-image). The video playback area (video) is another element.

    <div class="example_body">
       <div id='fs-image'>
          <img src="images/tizen_logo_light.png" alt="">
          <p id="log"></p>
          <p><button id="toggleImage">Toggle Image fullscreen</button></p>
          <video id="video" controls preload="none"
             <source id="mp4" src="http://media.w3.org/2010/05/sintel/trailer.mp4"
       <button id="toggleVideo">Toggle Video fullscreen</button>
  2. Define the fullscreen mode style by expressing the fullscreen status of the element with the :full-screen CSS pseudo-class (-webkit-full-screen):

       #fs-image: -webkit-full-screen {
          background: #39c;
       #fs-image: full-screen {
          background: #39c;
  3. Toggle between the normal and fullscreen mode by using the webkitCancelFullScreen() and webkitRequestFullScreen() methods:

        function toggleFullScreenHandler(e, target) {
            var target = document.getElementById(target);
            /* Check whether in fullscreen mode */
            if (document.webkitIsFullScreen) {
                /* Cancel the fullscreen mode */
            } else {
                /* Switch on the fullscreen mode */
        document.getElementById('toggleImage').addEventListener('click', function(e) {
            toggleFullScreenHandler(e, 'fs-image')
        }, false);
        document.getElementById('toggleVideo').addEventListener('click', function(e) {
            toggleFullScreenHandler(e, 'video')
        }, false);
        document.addEventListener('click', function(e) {
        }, false);

Figure: Normal and fullscreen modes

Normal and fullscreen modes

Source Code

For the complete source code related to this use case, see the following files:

  • Dependencies
    • Tizen 2.4 and Higher for Mobile
    • Tizen 3.0 and Higher for TV