check if Parent window is null javascript

Posted on 2011-03-02
Last Modified: 2012-05-11
function checkParentWindow(thisItem)
Question by:Rewaya
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 16

Expert Comment

ID: 35017483
Is there a question?

What are you trying to accomplish?


Author Comment

ID: 35017494
yes it doesn't work
 if(parent!=null)  check statement  throw exception
LVL 16

Accepted Solution

sjklein42 earned 500 total points
ID: 35017728
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)
                     thisItem.parent.hello(thisItem.thisValue);  //***** are you defining thisValue somewhere else? 

Open in new window

LVL 82

Expert Comment

ID: 35018482
Check this :

Try :
if( window.opener != null )

Open in new window


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question