I often find that to avoid undefined errors on dom stuff I have to do something like this:
if("undefined" != typeof parent
&& "undefined" != typeof parent.main
&& "undefined" != typeof parent.main.location){
// Act on a current iframe page from that page's parent location
}
Otherwise there's the potential to just get an undefined error when working with such heavily nested dom objects. Is there an easier way to check for these nested object properties without breaking everything?