views:

253

answers:

2

I tried something like, below in popup-window, but not working...

any correction at line 3, please suggest.

function closePopup() {
 window.opener.history.go(0);
 $(opener.document).ready(function(){
  window.opener.some_function(some_variable);
  self.close();
 });
}
+1  A: 

Two things:

  1. You can access Window#document of another window only if it is of the same origin (same host, port and protocol).
  2. Even if the above case is satisfied, the document object isn't constructed immediately after you navigate to a page. history.go() is not a synchronous operation.

Have you tried Window#load event instead?

Chetan Sastry
Thanks for ur reply. I need load event for parent window, (using "opener") usable in its popup window. I think "window.load" will work for current window.
Kumar
I meant `opener.load`. opener is a `Window` too. Maybe I should capitalize Window.
Chetan Sastry
i tried, and failed.Now i am using a delay bluntly in popup to wait until parent reloads.
Kumar
A: 

Check out this option: http://plugins.jquery.com/project/popupready

slap happy j