YouTip LogoYouTip

Met Win Focus

# Window focus() Method [![Image 4: Window Object Reference](#) Window Object](#) * * * ## Definition and Usage The focus() method sets focus to the current window, which means bringing the window to the front (closer to the screen). ## Syntax window.focus() * * * ## Browser Support | Method | | | | | | | --- | --- | --- | --- | --- | --- | | focus() | Yes | Yes | Yes | Yes | Yes | * * * ## Example ## Example Ensure the new window gets focus (bring it to the front): function openWin(){myWindow=window.open('','','width=200,height=100'); myWindow.document.write("

This is 'My Window'

"); myWindow.focus(); } [Try it yourself Β»](#) * * * ![Image 5: Example](#) ## More Examples (#) * * Window Object](#)
← Met Win MovebyMet Win Createpopup β†’