This is my Html.I need to open (same page)Page1.html in a new window, when I clicks in Page1.html.(First window)
So I used window.open() for acheving this.Its works and produces Second Window
But I also need to open same page(Page1.html) from the second window which was created from the First Window. So I used window.open() it is loading the Page1.html in the same window. It won’t create any other new windows. In practical scenario, I need to create a new window with B.html from A.html. Also from Second Window (B.html) I need to create another window with C.html. Currently B will open, but C will not create any new window, It simply loads C.html in second window which replaces B.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function ShowPage(pageName) {
window.open(pageName, null, 'height=400,width=800,status=yes,toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=yes');
}
</script>
<a id="page1.htm" onclick="ShowPage(this.id);">Click Me</a>
</body>
</html>
Have a new name for every window you open, because once a “named” window is already open, any
window.openthat uses that same name opens the content in that same window.OR
set the name to
"_blank"to open to a new window every time.the name of the window can be set via the second parameter (instead of null).
According to this MDN article