Nuestros voluntarios aún no han traducido este artículo al Español. ¡Únete a nosotros y ayúdanos a traducirlo!
También puedes leer el artículo en English (US).

Makes a request to bring the window to the front. It may fail due to user settings and the window isn't guaranteed to be frontmost before this method returns.

Syntax

window.focus() 

Example

if (clicked) { window.focus(); }

Specification

Specification Status Comment
HTML Living Standard
The definition of 'Window.focus()' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
focusChrome Full support 1
Notes
Full support 1
Notes
Notes Starting in Chrome 66, opening a popup in fullscreen mode and calling this function will end fullscreen mode.
Edge Full support 12Firefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
See implementation notes.
See implementation notes.

Etiquetas y colaboradores del documento

Etiquetas: 
Última actualización por: mdnwebdocs-bot,