In the system, javascript open window is used in some places. For example, opening a fixed-mode window prevents users from performing other operations.
Parameters:
Parameters | Value range | Description
alwaysLowered | yes/no | The specified window is hidden behind all windows
alwaysRaised | yes/no | The specified window is suspended above all windows
depended | yes/no | Whether to close at the same time as the parent window
directories | yes/no | Whether the directory bar of Nav2 and 3 is visible
height | pixel value | window height
hotkeys | yes/no | Set safe exit hotkey in a window without menu bar
innerHeight | pixel value | The pixel height of the document in the window
innerWidth | pixel value | The pixel width of the document in the window
location | yes/no | Whether the location bar is visible
menubar | yes/no | Whether the menu bar is visible
outerHeight | pixel value | Set the pixel height of the window (including decorative borders)
outerWidth | pixel value | Set the pixel width of the window (including decorative borders)
resizable | yes/no | Whether the window size is Adjustable
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 upper edge of the screen
scrollbars | yes/no | Whether the window can have scroll bars
titlebar | yes/no | Whether the window title 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 above other windows after being activated
Example:
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 the height and width according to the resolution:
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.
Question:
After window.open, if the system exits, an error will occur when using window.open to open a new page again.
I googled for a long time and couldn’t find it. Thinking that this problem should not happen often, it must be a configuration problem.
Among them, we can see that the second parameter of window.open is the name of the new window. This name cannot be repeated.
If it is repeated, keep opening and refreshing this window.
So I added a js random GUID function.
function s4() {
return Math.floor((1 Math.random()) * 0x10000)
.toString(16)
.substring(1);
};
function JsGuid() {
return s4() s4() ' -' s4() '-' s4() '-'
s4() '-' s4() s4() s4();
}
Use: window when opening a window .open("Main.aspx", "newwindow" JsGuid());
OK, the problem is solved.