Recursive call to in Javascript.

Go To


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 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 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="">
        <script type="text/javascript">
            function ShowPage(pageName) {
      , null, 'height=400,width=800,status=yes,toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=yes');
        <a id="page1.htm" onclick="ShowPage(;">Click Me</a>
2012-04-04 05:51
by kbvishnu


Have a new name for every window you open, because once a "named" window is already open, any that uses that same name opens the content in that same window.


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

If a window with the name strWindowName already exists, then strUrl is loaded into the existing window. In this case the return value of the method is the existing window and strWindowFeatures is ignored. Providing an empty string for strUrl is a way to get a reference to an open window by its name without changing the window's location. To open a new window on every call of, use the special value _blank for strWindowName.

2012-04-04 05:56
by Joseph
Thanks it works : - kbvishnu 2012-04-04 05:58


Try using '_blank' instead of null in the second argument of

2012-04-04 05:59
by mim