Nossos voluntários ainda não traduziram este artigo para o Português (do Brasil). Junte-se a nós e ajude-nos a fazer o trabalho!
Você também pode ler o artigo em English (US).

The Element.requestFullscreen() method issues an asynchronous request to make the element be displayed full-screen.

It's not guaranteed that the element will be put into full screen mode. If permission to enter full screen mode is granted, the document will receive a fullscreenchange event to let it know that it's now in full screen mode. If permission is denied, the document receives a fullscreenerror event instead.

This method must be invoked from a user interaction or a device orientation change, else it will fail.

Only elements which are in the HTML namespace (that is, elements which are standard HTML), plus the <svg> and <math> elements, which are located in the top-level document or in an <iframe> with the allowfullscreen attribute can be displayed full-screen. This means that elements inside a <frame> or an <object> can't.

Syntax

Element.requestFullscreen();

Example

Before calling requestFullscreen(), set up event handlers for the fullscreenchange and fullscreenerror events, so you know when you've successfully switched into full-screen mode (or when permission to do so has been denied).

tbd

Specifications

Specification Status Comment
Fullscreen API
The definition of 'Element.requestFullscreen()' in that specification.
Living Standard Initial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox Internet Explorer Edge Opera Safari
Basic support (Yes)webkit[1] 9.0 (9.0) as mozRequestFullScreen[2]
47.0 (47.0) (behind full-screen-api.unprefix.enabled
11ms[3] (Yes)[3] ? ?
Feature Chrome Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes)webkit[1] (Yes) 9.0 (9.0) as mozRequestFullScreen[2]
47.0 (47.0) (behind full-screen-api.unprefix.enabled
? ? ?

[1] Also implemented as webkitRequestFullscreen.

[2] Implemented as mozRequestFullScreen (notice the capital S for Screen). Before Firefox 44, Gecko incorrectly allowed elements inside a <frame> or an <object> to request, and to be granted, fullscreen. In Firefox 44 and onwards this has been fixed: only elements in the top-level document or in an <iframe> with the allowfullscreen attribute can be displayed fullscreen.

[3] See documentation on MSDN.

See also

Etiquetas do documento e colaboradores

 Última atualização por: mfuji09,