PDA

View Full Version : How to check validity of object before using it...



mcguile257
July 1st, 2004, 09:19 AM
Hi, I know that if a parent window launches a child window that opens a different domain than the parent, then the parent window will get a "permission denied" message when it tries to access properties of the child window.

Say my child window is childWindow1. How would I check the url of this window without getting that dreaded permission error? I thought about doing:

if ( typeof( childWindow1 ) == "undefined" )
{

}

but this didn't work, because I guess childWindow1 is still defined. I'm pretty sure using 'null' won't help either. But how do I check that it's a valid object to use before I start doing stuff like: "childWindow1.location.href"?

Please help!