+ Start a Discussion
CLKCLK 

Window.opener not working?

I want to access parents window javascript method from lookup(child) window's javascript. For this i am using window.opener to refer parent window, but i am getting error window.opener is null Anybody has idea why this is occuring or any other way to refer parent window from child window. It's very argent friends... any help would be appriciated. Thanks in advance.
Best Answer chosen by Admin (Salesforce Developers) 
CLKCLK
Hi all, Thanks for efforts & suggestions. I found out the solution for this; just replaced the window.opener with top.window.opener & it's worked. I got this solution from by seeing standard lookup Page javascript code. it could be workfull for you as well if you come across same problem

All Answers

SidzSidz

Am not really sure if this helps but if you are dealing with iframes or frames ,if the parent frame and the child frame are of different domains it usually doesnt allow cross domain scripting.

so you cannot control the actions of your parent or child frame from the other.

 

hope this helps,

sidz

 

sfdcfoxsfdcfox

Try using Google Chrome and trigger your code with the JavaScript Debugger open. It'll tell you if there's a security error going on. BTW, you might get better results using showModalDialog (which logically connects a child window with the parent, even across domains), or by using window.postMessage (a new HTML5 feature that allows a secure way for frames to talk across domains).

AnushaAnusha

this could be cause some times...

 

Check whether Development Mode for User, if it is on. off it and check

_Prasu__Prasu_

Hello Chetan,

 

You can access the Parent window handler if you have created the child window yourself from code. Also check if the domains which are loaded in the Parent window and Child window are different. If they are4 different then you can't call the JavaScript as its causes cross domain scriptting. And Brower will not allow it to perform.

 

Let us know if you have found solution to this.

CLKCLK
Hi all, Thanks for efforts & suggestions. I found out the solution for this; just replaced the window.opener with top.window.opener & it's worked. I got this solution from by seeing standard lookup Page javascript code. it could be workfull for you as well if you come across same problem
This was selected as the best answer