1

I have a parent page on one server and im calling a child page as pop up window which is on another server. So once the child page is closed i wanted to refresh the parent page so i wrote one reload function in parent page and i was trying to call it from child page as:

opener.reload();

But as parent is on another server this thing is not working, is there any way to achieve this?

rahul
  • 7,573
  • 7
  • 39
  • 53
Swati Awasthi
  • 237
  • 3
  • 8
  • 17

4 Answers4

0

instead of opener.reload

you can use submit()

somethig like this in ur javascript function

opener.document.forms[0].submit(); 

Source Docs

http://forums.asp.net/t/1412827.aspx/1

rahul
  • 7,573
  • 7
  • 39
  • 53
0

can you tell me how are opening a child page as pop up? if through colorbox or thickbox, then there is one onClose event on which you can write something like

function() 
{ 
    window.location.reload(true); 
}
Rahul
  • 928
  • 5
  • 8
  • Im using var popupWindow = window.open("URL", 'popUpWindow', 'height=350,width=550,left=550,top=300,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes') – Swati Awasthi Nov 22 '12 at 07:45
  • try this way.. write a function on your parent page and from pop call a function when you closing the pop up like window.opener.parentFunction(); under this function you can write window.location.reload(true); – Rahul Nov 22 '12 at 08:04
  • This is how i did, but as parent page is on another server, 'opener' thing is not working – Swati Awasthi Nov 22 '12 at 08:06
  • try another thing, call the page with some querystring in it, check on client side if that querystring is present, reload the page with window.location.reload(); – Rahul Nov 22 '12 at 08:13
0

Try this Javascript function in a parent page

 function GoTopage()
    {
     var retValue = showModalDialog ("child.aspx", "", "dialogWidth:600px; dialogHeight:300px; dialogLeft:200px;");
     if (retValue == null)
     {
     __doPostBack('', '');  /* For postback */  
     /*location.reload();  for complete reloading or refreshing*/
     }
     return false;

    }
Rajaram Shelar
  • 7,537
  • 24
  • 66
  • 107
0

This isn't exactly a good way of doing it, but it's the only way I can think of since there is the Same Origin Policy.

var timer, childWindow = window.open("https://google.ca/");

function hasClosed() {
    'use strict';
    if (childWindow && childWindow.closed) {
        // stop the timer
        window.clearInterval(timer);

        // do whatever here
        console.log('The window has closed');
    }
}

// set a timer to continually check if the window has closed
timer = window.setInterval(hasClosed, 1000);
rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156