In the system, some places use JavaScript open window. For example, open a fixed-mode window to prevent users from doing other things.
Parameters:
Copy Code code as follows:
Parameters | Value Range | Description
alwayslowered | yes/no | Specifies that the window is hidden behind all windows
alwaysraised | yes/no | Specifies that the window is suspended above all windows
depended | yes/no | Whether to close the parent window at the same time
Directories | yes/no | Whether the NAV2 and 3 columns are visible
Height | Pixel value | Window height
hotkeys | yes/no | Set up a secure exit hotkey in a window without a menu bar
Innerheight | Pixel value | Pixel height of the document in the window
Innerwidth | Pixel value | Pixel width of the document in the window
Location | yes/no | Whether the position bar is visible
MenuBar | yes/no | Whether the menu bar is visible
Outerheight | Pixel value | Set the pixel height of a window (including a decorative border)
Outerwidth | Pixel value | Set the pixel width of a window (including a decorative border)
resizable | yes/no | Whether the window size can be adjusted
ScreenX | Pixel value | The pixel length of the window from the left edge of the screen
ScreenY | Pixel value | The pixel length of the window from the edge of the screen
ScrollBars | yes/no | Whether a window can have a scroll bar
TitleBar | yes/no | Whether the window topic bar is visible
Toolbar | yes/no | Whether the window toolbar is visible
Width | Pixel value | The pixel width of the window
Z-look | yes/no | Whether the window floats on top of other windows when it is activated
Instance:
Copy Code code as follows:
window.open ("page.html", "NewWindow", "height=100, width=100, Top=0,left=0,toolbar=no, Menubar=no, Scrollbars=no, Resizable=no, Location=no, Status=no ")
Open after calculating height and width based on resolution:
Copy Code code as follows:
var ht = screen.height-98;
var widhh = screen.width-20;
Window.opener = null;
window.open ("", "_self");
window.open ("Main.aspx", "NewWindow" + jsguid (),
"height=" + HT + ", width=" + WIDHH + ",
Depended=yes,top=0,left=0,toolbar=no, Menubar=no,
Scrollbars=yes, Resizable=no, Location=no, Status=yes ");
Window.close ();
and close the original window.
Problem:
After window.open, an error occurs when the system exits, using window.open again to open a new page.
Google did not find a half-day. The question that should not happen frequently is definitely a problem of configuration.
Where we can see that the second parameter of window.open is the name of the new window. This name is not to be repeated.
If you repeat, you are always opening the refresh in this window.
So I added a JS random GUID function.
Copy Code code as follows:
Function S4 () {
Return Math.floor ((1 + math.random ()) * 0x10000)
. toString (16)
. substring (1);
};
function Jsguid () {
Return S4 () + S4 () + '-' + S4 () + '-' + S4 () + '-' +
S4 () + '-' + S4 () + S4 () + S4 ();
}
Open the window when using: window.open ("main.aspx", "NewWindow" + jsguid ());
OK, problem solved.