A memo about opening a window of Web browsers.
var win = window.open(url, target, features)
url
The location of the loaded resource, or "about:blank".
-
Initially, an opened window has "about:blank", and then sets a specified URL when the window start to loaded the URL.
-
If this URL is an empty string, null or undefined, and target is not empty and not 'about:blank', gets and focus a window named to target. The window is not reloaded.
-
If this URL is a sequence of white spaces, and target is not empty and not 'about:blank', gets and focus a window named to target. The window is reloaded.
-
If this URL is a invalid string or invalid type, raise s
ERR_FILE_NOT_FOUND
. -
If this URL is not found, raises
ERR_FILE_NOT_FOUND
.
target
A window name to be opened, or a keyword which indicates a target window.
-
If this value is
"_blank"
, opens a new window and make it target. -
If this value is
"_self"
, opens no new window and make the window itself target. -
If this value is
"_parent"
, opens no new window and:- If the window has a parent window, reload its parent window
- If the window does not have its parent window (
window.self === window.parent
), make th window itself target.
A "parent" window is an immediately upper window in a hierarchy of frameset windows and/or iframes.
"Frameset window" means not a hierarchy of framesets but a hierarchy of windows. If there are some framesets in a window, the count of 'frameset window' is 1.
-
If this value is
"_top"
, opens no new window and:- If the window has a parent window and does not have any other ancestor windows (
window.parent === window.top
), make its parent widnow target. - If the window has a parent window and has other ancestor windows (
window.parent !== window.top
), reload the topmost window. - If the window does not have its parent window, make the window itself target.
- If the window has a parent window and does not have any other ancestor windows (
-
If this value is an empty string, null or undefined, behaves as same with
_blank
. -
If this value is a name of which windows exists, make the first among them target.
-
If this value is a name of which window does not exist, opens a new window and make it target.
-
If this value is invalid type, names a opened window to
String(<invalid-value>)
and then behaves as above.
features
A string which concatenates key-value pairs with comma.
-
If a key is
"left"
, sets.screenX
of a opened window. -
If a key is
"top"
, sets.screenY
of a opened window. -
If a key is
"width"
, sets.innerWidth
of a opened window. -
If a key is
"height"
, sets.innerHeight
of a opened window.
win
An opened window by this function.
-
There are cases that this window is null when spending much time to open this window.
- At that time, you can get the window object by:
var win = window.open('', name)
- At that time, you can get the window object by: