Sometimes, we want to achieve a <a> through JS the effect of a new tab, at this time we think of the window.open method implementation. So how exactly should window.open be used?
We know that window.open can open a new window or tab (which is usually related to the browser's setup options), load the specified URL into a new or existing window, and return the Window object that represents it. Window.close can close the window, but can only automatically close JS open window, if you want to close other windows, you must prompt the user to determine or cancel the operation (this browser-related, measured IE need to be prompted to turn off; other browsers do not allow automatic shutdown).
We can open the window directly using window.open () and close the window using Window.close ()
<! DOCTYPE html>
window.open (URL, name[, property][, Boolean]) requires four parameters:
First parameter URL: The URL of the document displayed in the new window, if omitted or empty, uses ' About:blank '
Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/script/
Second parameter name: The name of the new window, which can be used with target and, if omitted, will use ' _blank ' (here is a brief introduction: _parent and _top,_parent refer to the Direct parent window, _top refers to the top-level ancestor window)
The third parameter protery: an optional parameter separated by commas, containing the window size and various properties. If omitted, the default size and standard UI components are used (explicit invocations are more like open windows rather than labels). This parameter is non-standard, and the HTML5 specification also advocates that browsers ignore it.
Fourth argument Boolean: Valid only if the second argument is named the existing window. Declares the URL specified by the first parameter, replacing the current entry for the window's browsing history.
Window.opener refers to the original window, if not, to null.
<! DOCTYPE html>