Web Analytics Made Easy -
StatCounter check if an opener exists - CodingForum

Announcement

Collapse
No announcement yet.

check if an opener exists

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • check if an opener exists

    To check if a parent page exist is easy

    if(parent.frames.length==0)

    but it seems like if opener, the similar woun't work...

    if(window.opener.length==0) gives errors

    Any ideea how to check if an opener exists?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #2
    Remarks

    The opener property is available only for frame and iframe pages.

    Internet Development SDK
    hmm... ?

    Comment


    • #3
      Actually, this seems to work: opener.closed
      hmm... ?

      Comment


      • #4
        opener is a reference to the actual "window" object that opened the popup. opener.length, then, would be window.length, which isn't anything, so your if statement would always fail ( unless you've got some variable you named "length") as Swmr noted, the way to find out if the opener exists, is with the boolean closed property.
        bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

        i am a loser geek, crazy with an evil streak,
        yes i do believe there is a violent thing inside of me.

        Comment


        • #5
          The opener property is available only for frame and iframe pages.
          I don't think so... Maybe

          The opener property is available only for pop-ups and other pages opened with a window.open() JS method.

          For frame and iframe the reference is parent
          KOR
          Offshore programming
          -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

          Comment


          • #6
            Right, I realized that after remembering about the closed property; the quote I referred to must have been a mistake...
            hmm... ?

            Comment


            • #7
              further more, opener... in fact window.opener is an object, not a property...

              Now it looks like I have something:

              if(opener && typeof opener.document != 'undefined')
              {
              // exists
              }

              I think this might be the answer
              KOR
              Offshore programming
              -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

              Comment


              • #8
                Originally posted by Kor
                further more, opener... in fact window.opener is an object, not a property...
                opener is a property of window.

                closed is a property of opener.

                ... and, you're welcome.
                hmm... ?

                Comment


                • #9
                  Originally posted by Kor
                  further more, opener... in fact window.opener is an object, not a property...

                  Now it looks like I have something:

                  if(opener && typeof opener.document != 'undefined')
                  {
                  // exists
                  }

                  I think this might be the answer
                  No.
                  Must be:

                  if(opener && !opener.closed)
                  {
                  // exists
                  }
                  Glenn
                  vBulletin Mods That Rock!

                  Comment

                  Working...
                  X