1. Get the internal width and height of the browser (not including toolbars and scroll bars)
Window.innerwidth | | document.body.clientwidth| | Document.documentElement.clientWidth;
Window.innerheight | | document.body.clientheight| | Document.documentElement.clientHeight;
2. Open a Windows window
window.open (Url,name,features,replace);
| Parameters |
Description |
| Url |
An optional string that declares the URL of the document to display in a new window. If this argument is omitted, or if its value is an empty string, then the new window will not display any documents. |
| Name |
An optional string that is a comma-delimited list of features, including numbers, letters, and underscores that declare the name of the new window. This name can be used as the value of the tag <a> and <form> property target. If the parameter specifies a window that already exists, the open () method no longer creates a new window, but simply returns a reference to the specified window. In this case, the features will be ignored. |
| Features |
An optional string that declares the characteristics of the standard browser to be displayed for the new window. If this argument is omitted, the new window will have all the standard features. |
| Replace |
An optional Boolean value, True/false. Specifies whether the URL loaded into the window creates a new entry in the window's browsing history or replaces the current entry in the browsing history. |
| Channelmode=yes|no|1|0 |
Whether to use the theater Mode Display window. The default is No. |
| Fullscreen=yes|no|1|0 |
Whether to use full-screen mode to display the browser. The default is No. A window in full-screen mode must be in theater mode at the same time. |
| Directories=yes|no|1|0 |
Whether to add a catalog button. The default is yes. |
| Location=yes|no|1|0 |
Whether the Address field is displayed. The default is yes. |
| Menubar=yes|no|1|0 |
Whether the menu bar is displayed. The default is yes. |
| Status=yes|no|1|0 |
Whether to add a status bar. The default is yes. |
| Titlebar=yes|no|1|0 |
Whether the title bar is displayed. The default is yes. |
| Toolbar=yes|no|1|0 |
Whether to display the browser's toolbar. The default is yes. |
| Height=pixels |
The height of the window document display area. measured in pixels. |
| Width=pixels |
The width of the document display area of the window. measured in pixels. |
| Left=pixels |
The x-coordinate of the window. measured in pixels. |
| Top=pixels |
The y-coordinate of the window. measured in pixels. |
| Resizable=yes|no|1|0 |
Whether the window can be adjusted for size. The default is yes. |
| Scrollbars=yes|no|1|0 |
Whether scroll bars are displayed. The default is yes. |
Cases:
var Mywindow = window.open (' http://www.baidu.com ', ' _blank ', ' directories=yes, Location=yes, Menubar=yes, Status=yes, Titlebar=yes, Toolbar=yes, width=800, height=400, left=200, top=200 ');
Mywindow.close (); Close window
JavaScript window-Browser Object model