check if Parent window is null javascript

function checkParentWindow(thisItem)
        {
              ;
                .....
              if(parent!=null)
              {
                     parent.hello(thisValue);
                     self.close();
                }
        }
RewayaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
sjklein42Connect With a Mentor Commented:
Try "thisItem.parent" instead.  Your implied use of "this" inside the function is not giving you the object that was passed as the input parameter "thisItem".  "this" inside the function probably means the function itself.

We might need to see the entire routine to give better advice.

It is not clear what you are trying to fetch with "thisValue".


function checkParentWindow(thisItem)
        {
              ;
                .....
              if(thisItem.parent!=null)
              {
                     thisItem.parent.hello(thisItem.thisValue);  //***** are you defining thisValue somewhere else? 
                     thisItem.close();
                }
        } 

Open in new window

0
 
sjklein42Commented:
Is there a question?

What are you trying to accomplish?

0
 
RewayaAuthor Commented:
yes it doesn't work
 if(parent!=null)  check statement  throw exception
             
0
 
leakim971PluritechnicianCommented:
Check this : http://www.w3schools.com/jsref/prop_win_opener.asp

Try :
if( window.opener != null )

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.