Click here to Skip to main content
13,050,764 members (85,292 online)
Rate this:
Please Sign up or sign in to vote.
i have write following type of code for open new window using javascript

printURL= "abcd.aspx";
ClientScript.RegisterStartupScript(this.GetType(), "newWindow", "<script>'" + printURL + "', '', 'top=100,left=300,menubar=no,toolbar=no,location=no,resizable=no,height=600,width=850,status=no,scrollbars=yes,maximize=null,resizable=0,titlebar=no');</script>");

its working fine, its open when i am clicking on "window open button". but when i minimize the window and again click on "window open button" new window open in other window, i want to open new window on same window, please suggest me.

waiting for reply.
Posted 24-Jul-12 4:03am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The answer is - You cannot...

This is because your parent page does not know about the new window opened on your previous click. There is no connection between these parent and child instances of the browser windows. So each time you click the link it will create a new instance of browser and as a result a new window everytime.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Check this out:
<script type="text/javascript">
var theWin = null;
function open_win(url)
    if(theWin && theWin.location)
        theWin =,"TheWin",'top=100,left=300,menubar=no,toolbar=no,location=no,resizable=no,height=600,width=850,status=no,scrollbars=yes,maximize=null,resizable=0,titlebar=no');
<a href="#" onclick="open_win('')" />google</a>
<a href="#" onclick="open_win('')" />yahoo</a>

Note: with IE has some limitations (see:[^])
omprakash katre 25-Jul-12 1:41am
Thanks for reply.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

i have got the solution

function openWindow(printURL) {
             var newWin =, 'PrintABC', 'top=100,left=300,menubar=no,toolbar=no,location=no,resizable=no,height=600,width=850,status=no,scrollbars=yes,maximize=null,resizable=0,titlebar=no');
             if (newWin != null) {
                 void (0);
Zoltán Zörgő 25-Jul-12 7:01am
I think I posted the solution hours before you did. :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100