O evento visibilitychange
é ativado quando o conteúdo de um separador se torna visível ou foi ocultado.
Informação geral
- Especificação
- Page Visibility (Second Edition)
- Interface
event
- Bubbles
- Sim
- Cancelável
- Não
- Destino
Document
- Ação Predefinida
- None
Propriedades
Propriedade | Tipo | Descrição |
---|---|---|
target Read only |
EventTarget |
The event target (the topmost target in the DOM tree). |
type Read only |
DOMString |
The type of event. |
bubbles Read only |
Boolean |
Whether the event normally bubbles or not. |
cancelable Read only |
Boolean |
Whether the event is cancellable or not. |
Exemplo
document.addEventListener("visibilitychange", function() {
console.log( document.visibilityState );
});
Especificações
Especificação | Estado | Comentário |
---|---|---|
Page Visibility (Second Edition) The definition of 'visibilitychange' in that specification. |
Recommendation |
Compatibilidade de navegador
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!
Funcionalidade | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Suporte básico | 13 webkit 33 |
10 (10) moz 18 (18) |
10 |
12.10[1] |
6.1 |
Funcionalidade | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Suporte básico | 4.4 webkit | 10.0 (10) moz 18.0 (18) |
? | 12.10 [1] | 7 |
[1] Doesn't fire the visibilitychange
event when the browser window is minimized, nor set hidden
to true
.