document.mozFullScreenElement

  • Revision slug: Web/API/document.mozFullScreenElement
  • Revision title: document.mozFullScreenElement
  • Revision id: 472005
  • Created:
  • Creator: Reachmeatshivam
  • Is current revision? No
  • Comment

Revision Content

{{ DomRef() }}

Summary

Returns the {{ domxref("Element") }} that is currently being presented in full-screen mode in this document, or null if full-screen mode is not currently in use.

Syntax

var element = document.mozFullScreenElement;

On return, element is the {{ domxref("element") }} that is currently in full-screen mode, or null if full-screen mode isn't currently in use by the document.

Example

 

function isVideoInFullsreen() {
  if (document.mozFullScreenElement && document.mozFullScreenElement.nodeName == 'VIDEO') {
    console.log('Your video is playing in fullscreen');
  }
}

Notes

See Using full-screen mode for details and examples.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatUnknown() }} {{ CompatGeckoDesktop("9.0") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatGeckoMobile("9.0") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

Specification

This method has been proposed in the specification draft http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-document-fullscreenelement

See also

  • Using full-screen mode
  • {{ domxref("element.mozRequestFullScreen()") }}
  • {{ domxref("document.mozCancelFullScreen()") }}
  • {{ domxref("document.mozFullScreen") }}
  • {{ domxref("document.mozFullScreenEnabled") }}
  • {{ cssxref(":-moz-full-screen") }}
  • {{ HTMLAttrXRef("allowfullscreen", "iframe") }}

Revision Source

<p>{{ DomRef() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Returns the {{ domxref("Element") }} that is currently being presented in full-screen mode in this document, or <code>null</code> if full-screen mode is not currently in use.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre class="eval">
<em>var element</em> = <em>document</em>.mozFullScreenElement;
</pre>
<p>On return, element is the {{ domxref("element") }} that is currently in full-screen mode, or <code>null</code> if full-screen mode isn't currently in use by the document.</p>
<h3 id="Example" name="Example">Example</h3>
<p>&nbsp;</p>
<pre class="eval">
function isVideoInFullsreen() {
  if (document.mozFullScreenElement &amp;&amp; document.mozFullScreenElement.nodeName == 'VIDEO') {
    console.log('Your video is playing in fullscreen');
  }
}</pre>
<h3 id="Notes">Notes</h3>
<p>See <a href="/en/DOM/Using_full-screen_mode" title="en/DOM/Using full-screen mode">Using full-screen mode</a> for details and examples.</p>
<h3 id="Specification" name="Specification">Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatGeckoDesktop("9.0") }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatGeckoMobile("9.0") }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h3 id="Specification" name="Specification">Specification</h3>
<p>This method has been proposed in the specification draft&nbsp;<a class="external" href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-document-fullscreenelement" title="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-document-fullscreenelement">http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#dom-document-fullscreenelement</a></p>
<h3 id="See_also">See also</h3>
<ul>
  <li><a href="/en/DOM/Using_full-screen_mode" title="en/DOM/Using full-screen mode">Using full-screen mode</a></li>
  <li>{{ domxref("element.mozRequestFullScreen()") }}</li>
  <li>{{ domxref("document.mozCancelFullScreen()") }}</li>
  <li>{{ domxref("document.mozFullScreen") }}</li>
  <li>{{ domxref("document.mozFullScreenEnabled") }}</li>
  <li>{{ cssxref(":-moz-full-screen") }}</li>
  <li>{{ HTMLAttrXRef("allowfullscreen", "iframe") }}</li>
</ul>
Revert to this revision