Search code examples
javascripthttp-redirectasp-classicpopup

Restore Window Size on Redirect from PopUp


There is probably a simple solution for this, but I don't know what it is. I have a pop-up window in which I perform a standard Response.Redirect to a new page, based upon a radio-button selection. Everything works as expected, but the new page is the same size as the pop-window (as it is appearing IN the same pop-up window). How would I go about making the new page appear as a normal page and not in the pop-up window?


function EditOrder(f) {

var orderid_values = document.getElementsByName('OrderIDValues');
var orderid_value;

    for(var i = 0; i < orderid_values.length; i++){
        if(orderid_values[i].checked){
        orderid_value = orderid_values[i].value;
        }
    }

    window.open("/memberlogin/orders/editorderpopup.asp?cert=<%=sCertificate%>&loginid=<%=iSessID%>&cid=<%=iCustomerID%>&oid=" + orderid_value,"dialogCancelOrder","resizable=0,scrollbars=yes,location=yes,toolbar=no,status=no,top=200,left=500,width=900,height=900")

} 
</script> 

Then, in the EDITORDERPOPUP.ASP page, the following redirect occurs based upon the radio button selected (this is just a snippet out of the page):

' Based upon the radio button value (1,2,3.., etc.), call the EDITORDER.ASP page with the "editmode" = to the same value:

sURL = sRootDomain & "/administration/manualordering/editorder.asp?cert=" & sCertificate & "&loginID=" & iSessID & "&EditMode=" & RadioButtonValue

The new page is then displayed in the popup window. I would like the new page to be a completely new window, or be a full window.


Solution

  • Response.Redirect will always occur in same window/tab, so to redirect to another window/tab you should use client and not server scripting.

    Example:

    Master page that opens popup using client <script>

    <button onclick="popup()">Open popup</button> 
    <script> 
        function popup() {
            window.open('popup.asp', '', 'height=400,width=400');
        }
    </script>
    

    popup.asp that has nothing but client <script>

    <input type="radio" id="a" name="r1" onclick="win1()" />
    <input type="radio" id="b" name="r1" onclick="win2()" />
    
    <script>
        function win1() {
            window.open('https://stackoverflow.com');
        }
        function win2() {
            window.open('https://microsoft.com');
        }
    </script>