Window blur() Method
Example
Assure that the new window does NOT get focus (send the new window to the background):
var
myWindow = window.open("", "", "width=200, height=100");
// Opens a new window
myWindow.document.write("<p>A new window!</p>"); // Some text in the new window
myWindow.blur(); // Assures that the new window does NOT get focus
Try it yourself »
More "Try it Yourself" examples below.
Definition and Usage
The blur() method removes focus from the current window.
Tip: Use the focus() method to set focus to the current window.
Note: This method makes a request to bring the current window to the background. It may not work as you expect in all browsers, due to different user settings.
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
blur() | Yes | Yes | Yes | Yes | Yes |
Syntax
window.blur()
Parameters
None |
Return Value
No return value |
More Examples
Example
Assure that the new window GETS focus (send the new window to the front):
var
myWindow = window.open("", "", "width=200, height=100"); //
Opens a new window
myWindow.document.write("<p>A new window!</p>");
// Some text in the new window
myWindow.focus(); // Assures that the new window gets focus
Try it yourself »
Window Object