using iframes in Safari

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • luckydenis2007@yahoo.com

    using iframes in Safari

    I am trying to access image information that is displayed using
    iframe.
    iframe code looks like this:
    <iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
    frameborder="0" style="border: 0; width: 280px; height: 455px;"></
    iframe>

    I need to figure out height of the image.

    In Firefox and IE it is not a problem.

    document.getEle mentById('testI mage').contentW indow.document. getElementsByTa gName('img')
    [0].height
    document.getEle mentById('testI mage').contentW indow.contentDo cument.height

    But in Safari contentWindow is undefined.

  • RobG

    #2
    Re: using iframes in Safari

    On Mar 17, 9:52 am, luckydenis2...@ yahoo.com wrote:
    I am trying to access image information that is displayed using
    iframe.
    iframe code looks like this:
    <iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
    frameborder="0" style="border: 0; width: 280px; height: 455px;"></
    iframe>
    >
    I need to figure out height of the image.
    >
    In Firefox and IE it is not a problem.
    >
    document.getEle mentById('testI mage').contentW indow.document. getElementsByTa gName('img')
    [0].height
    document.getEle mentById('testI mage').contentW indow.contentDo cument.height
    >
    But in Safari contentWindow is undefined.
    contentWindow is an MS proprietary property of frame and iframe
    elements, it may not be supported by browsers other than IE so make
    sure you test for it before attempting to use it.


    --
    Rob

    Comment

    • luckydenis2007@yahoo.com

      #3
      Re: using iframes in Safari

      I was able to use it in Firefox. But my problem is Safari.

      On Mar 17, 12:08 am, "RobG" <r...@iinet.net .auwrote:
      On Mar 17, 9:52 am, luckydenis2...@ yahoo.com wrote:
      >
      >
      >
      I am trying to access image information that is displayed using
      iframe.
      iframe code looks like this:
      <iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
      frameborder="0" style="border: 0; width: 280px; height: 455px;"></
      iframe>
      >
      I need to figure out height of the image.
      >
      In Firefox and IE it is not a problem.
      >
      document.getEle mentById('testI mage').contentW indow.document. getElementsByTa gName('img')
      [0].height
      document.getEle mentById('testI mage').contentW indow.contentDo cument.height
      >
      But in Safari contentWindow is undefined.
      >
      contentWindow is an MS proprietary property of frame and iframe
      elements, it may not be supported by browsers other than IE so make
      sure you test for it before attempting to use it.
      >
      --
      Rob

      Comment

      • -Lost

        #4
        Re: using iframes in Safari

        "RobG" <rgqld@iinet.ne t.auwrote in message
        news:1174104489 .060187.59420@n 76g2000hsh.goog legroups.com...
        On Mar 17, 9:52 am, luckydenis2...@ yahoo.com wrote:
        >I am trying to access image information that is displayed using
        >iframe.
        >iframe code looks like this:
        ><iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
        >frameborder="0 " style="border: 0; width: 280px; height: 455px;"></
        >iframe>
        >>
        >I need to figure out height of the image.
        >>
        >In Firefox and IE it is not a problem.
        >>
        >document.getEl ementById('test Image').content Window.document .getElementsByT a
        >gName('img')
        >[0].height
        >document.getEl ementById('test Image').content Window.contentD ocument.height
        >>
        >But in Safari contentWindow is undefined.
        >
        contentWindow is an MS proprietary property of frame and iframe
        elements, it may not be supported by browsers other than IE so make
        sure you test for it before attempting to use it.
        Sure would be nice if the older pages at Mozilla could get a little update. I remember it
        losing out in Mozilla, but cannot find where I read it.

        The original poster can use document.defaul tView instead of contentWindow.

        -Lost


        Comment

        • -Lost

          #5
          Re: using iframes in Safari

          "-Lost" <missed-spam@comcast.ne twrote in message
          news:9YOdnQA8zd AbNGbYnZ2dnUVZ_ oSnnZ2d@comcast .com...
          "RobG" <rgqld@iinet.ne t.auwrote in message
          news:1174104489 .060187.59420@n 76g2000hsh.goog legroups.com...
          >On Mar 17, 9:52 am, luckydenis2...@ yahoo.com wrote:
          >>I am trying to access image information that is displayed using
          >>iframe.
          >>iframe code looks like this:
          >><iframe id="testImage" src="/images/someimg.gif" scrolling="yes"
          >>frameborder=" 0" style="border: 0; width: 280px; height: 455px;"></
          >>iframe>
          >>>
          >>I need to figure out height of the image.
          >>>
          >>In Firefox and IE it is not a problem.
          >>>
          >>document.getE lementById('tes tImage').conten tWindow.documen t.getElementsBy Ta
          >>gName('img' )
          >>[0].height
          >>document.getE lementById('tes tImage').conten tWindow.content Document.height
          >>>
          >>But in Safari contentWindow is undefined.
          >>
          >contentWindo w is an MS proprietary property of frame and iframe
          >elements, it may not be supported by browsers other than IE so make
          >sure you test for it before attempting to use it.
          >
          Sure would be nice if the older pages at Mozilla could get a little update. I remember
          it losing out in Mozilla, but cannot find where I read it.
          >
          The original poster can use document.defaul tView instead of contentWindow.
          Oops, scratch that. I know diddly about Safari, so no clue if what I suggested is an
          alternative or not.

          -Lost


          Comment

          • ASM

            #6
            Re: using iframes in Safari

            luckydenis2007@ yahoo.com a écrit :
            I was able to use it in Firefox. But my problem is Safari.
            with Safari the document of iframe is empty ... !
            (for sure ! ! ! :-( )

            Little test (in old JS) :

            <html>
            <iframe id="testImage" name="testImage " src="test.gif" scrolling="yes"
            frameborder="0" style="border: 0; width: 580px; height: 455px;">
            </iframe>

            <form onsubmit="retur n false;">
            <p>Works with : FF 2, Opera 9, iCab 3.0.3 :
            <button onclick="
            if(parent.testI mage.document.i mages)
            alert(parent.te stImage.documen t.images.length >0);
            ">is there an image ? </button>
            </p>
            <p>Works with : FF 2, Opera 9, iCab 3.0.3 :
            <button onclick="
            if(parent.testI mage.document.i mages)
            alert(parent.te stImage.documen t.images[0].height);">heig ht </button>
            </p>
            <p>Works with : FF 2 *AND* Safari 1.3<br>
            but *NOT* with Opera 9 and iCab 3.0.3, :
            <button onclick="
            var I = new Image();
            I.src = parent.testImag e.location;
            alert(I.height) ;
            ">height </button>
            </p>
            </form>
            </html>

            --
            Stephane Moriaux et son (moins) vieux Mac déjà dépassé
            Stephane Moriaux and his (less) old Mac already out of date

            Comment

            Working...