Whta's the Story with document.createElement('iframe') in IE?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vunet

    Whta's the Story with document.createElement('iframe') in IE?

    It is recommended by some sources I found to create IFrames in IE
    using
    document.create Element('<ifram e src="#">')
    instead of document.create Element('iframe ').
    Why and what browser versions to use it? IE5 or IE6?
    Thanks
  • Henry

    #2
    Re: Whta's the Story with document.create Element('iframe ') in IE?

    On Sep 9, 3:37 pm, vunet wrote:
    It is recommended by some sources I found to create
    IFrames in IE using
    document.create Element('<ifram e src="#">')
    instead of document.create Element('iframe ').
    Why
    The generally quality of browser issue analysis is extremely poor and
    may things get suggested as workarounds for issues that have never
    been pinned down or understood by the people making those suggestions.
    and what browser versions to use it? IE5 or IE6?
    There is no reason to use it at all, at the very least (and certainly)
    from IE 6.

    Comment

    • vunet

      #3
      Re: Whta's the Story with document.create Element('iframe ') in IE?

      >
      There is no reason to use it at all, at the very least (and certainly)
      from IE 6.
      It's not what I've seen around. In fact there was a case where I was
      submitting form to remote IFRAME. That never worked for IE6 until I
      used the syntax above to fix it, because the was no possible
      communication with that IFRAME using IE6.
      But are you saying that this workaround could be without the fix I
      explain? Also, here is another link where iframe is created like so:
      document.create Element('<ifram e src="#">')



      Thanks

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Whta's the Story with document.create Element('iframe ') in IE?

        vunet wrote:
        [Henry wrote:]
        >There is no reason to use it at all, at the very least (and certainly)
        >from IE 6.
        >
        It's not what I've seen around. In fact there was a case where I was
        submitting form to remote IFRAME. That never worked for IE6 until I
        used the syntax above to fix it, because the was no possible
        communication with that IFRAME using IE6.
        But are you saying that this workaround could be without the fix I
        explain?
        User agents based on MSHTML 5.0 and later support this method of W3C DOM
        Level 1+ as it was specified. There is no workaround necessary at all.
        Also, here is another link where iframe is created like so:
        document.create Element('<ifram e src="#">')
        >
        http://developer.apple.com/internet/...nt/iframe.html
        So we should eat sh*t because a million flies -- and especially the big,
        noisy ones -- cannot be wrong?

        Please trim, but do not remove, GG's default attribution line.


        PointedEars
        --
        var bugRiddenCrashP ronePieceOfJunk = (
        navigator.userA gent.indexOf('M SIE 5') != -1
        && navigator.userA gent.indexOf('M ac') != -1
        ) // Plone, register_functi on.js:16

        Comment

        • vunet

          #5
          Re: Whta's the Story with document.create Element('iframe ') in IE?

          On Sep 9, 11:26 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
          wrote:
          vunet wrote:
          [Henry wrote:]
          There is no reason to use it at all, at the very least (and certainly)
          from IE 6.
          >
          It's not what I've seen around. In fact there was a case where I was
          submitting form to remote IFRAME. That never worked for IE6 until I
          used the syntax above to fix it, because the was no possible
          communication with that IFRAME using IE6.
          But are you saying that this workaround could be without the fix I
          explain?
          >
          User agents based on MSHTML 5.0 and later support this method of W3C DOM
          Level 1+ as it was specified.  There is no workaround necessary at all.
          >
          Also, here is another link where iframe is created like so:
          document.create Element('<ifram e src="#">')
          >>
          So we should eat sh*t because a million flies -- and especially the big,
          noisy ones -- cannot be wrong?
          >
          Please trim, but do not remove, GG's default attribution line.
          >
          PointedEars
          --
          var bugRiddenCrashP ronePieceOfJunk = (
              navigator.userA gent.indexOf('M SIE 5') != -1
              && navigator.userA gent.indexOf('M ac') != -1
          )  // Plone, register_functi on.js:16
          OK, so I understand you do not agree with that workaround but if it
          was used and it did fix the problem, then what is your better and
          correct (!) suggestion to handle those situations?

          Comment

          • Henry

            #6
            Re: Whta's the Story with document.create Element('iframe ') in IE?

            On Sep 9, 4:39 pm, vunet wrote:
            On Sep 9, 11:26 am, Thomas 'PointedEars' Lahn wrote:
            <snip>
            >>Also, here is another link where iframe is created
            >>like so: document.create Element('<ifram e src="#">')
            >>
            >So we should eat sh*t because a million flies -- and
            >especially the big, noisy ones -- cannot be wrong?
            >
            <snip>
            OK, so I understand you do not agree with that workaround
            but if it was used and it did fix the problem,
            Which problem?
            then what is your better and correct (!) suggestion
            to handle those situations?
            There is no reason for not using the DOM standard element creation
            method for IFRAMEs in any (reasonably) DOM standard browser (and IE
            6+).

            But if you are challenging people to produce better solutions to
            problems you need to state what the problem is that is supposed to be
            addressed by the solution, else you are just waiting everyone's time.

            Comment

            • Henry

              #7
              Re: Whta's the Story with document.create Element('iframe ') in IE?

              On Sep 9, 4:14 pm, vunet wrote:
              >There is no reason to use it at all, at the very least
              >(and certainly) from IE 6.
              >
              It's not what I've seen around.
              So what? If you look you will be able to find someone on the Internet
              telling you anything and everything.
              In fact there was a case where I was submitting form to
              remote IFRAME. That never worked for IE6 until I used
              the syntax above to fix it, because the was no possible
              communication with that IFRAME using IE6.
              What does "no possible communication" mean? You see what I man about
              the quality of analysis? Communicating, in the sense of reading object
              properties, executing contained scripts and so on, is entirely
              possible in IE 6, I do it all the time.
              But are you saying that this workaround could be without
              the fix I explain?
              You did not explain anything, and you have not stated what it is that
              is supposed to be worked around.
              Also, here is another link where iframe is created like so:
              document.create Element('<ifram e src="#">')
              >
              http://developer.apple.com/internet/...nt/iframe.html
              <quote cite="http://developer.apple .com/internet/webcontent/
              iframe.html">
              Sadly, referencing the IFRAME's document object is no simple
              task, since IE5, IE5.5, IE6, and NS6 all provide different
              ways to access it. ...
              </quote>

              IE 5, 6 and 7, all Netscape 6+/Mozilla/Firefox/Gecko, Opera, Safari,
              and quite a list of other browsers all provide a single consistent and
              reliable method of accessing the documents contained in IFRAMEs. If
              the author of that page is not aware of that fact then it is not
              surprising that he/she has wondered off into a world of stupid
              workarounds and UA branching code to try and mitigate for their
              evident ignorance. It happens all the time, but that does not make
              following a good idea.

              Comment

              • vunet

                #8
                Re: Whta's the Story with document.create Element('iframe ') in IE?

                On Sep 9, 12:03 pm, Henry <rcornf...@rain drop.co.ukwrote :
                On Sep 9, 4:14 pm, vunet wrote:
                >
                There is no reason to use it at all, at the very least
                (and certainly) from IE 6.
                >
                It's not what I've seen around.
                >
                So what? If you look you will be able to find someone on the Internet
                telling you anything and everything.
                >
                In fact there was a case where I was submitting form to
                remote IFRAME. That never worked for IE6 until I used
                the syntax above to fix it, because the was no possible
                communication with that IFRAME using IE6.
                >
                What does "no possible communication" mean? You see what I man about
                the quality of analysis? Communicating, in the sense of reading object
                properties, executing contained scripts and so on, is entirely
                possible in IE 6, I do it all the time.
                >
                But are you saying that this workaround could be without
                the fix I explain?
                >
                You did not explain anything, and you have not stated what it is that
                is supposed to be worked around.
                >
                Also, here is another link where iframe is created like so:
                document.create Element('<ifram e src="#">')
                >>
                <quote cite="http://developer.apple .com/internet/webcontent/
                iframe.html">
                Sadly, referencing the IFRAME's document object is no simple
                task, since IE5, IE5.5, IE6, and NS6 all provide different
                ways to access it. ...
                </quote>
                >
                IE 5, 6 and 7, all Netscape 6+/Mozilla/Firefox/Gecko, Opera, Safari,
                and quite a list of other browsers all provide a single consistent and
                reliable method of accessing the documents contained in IFRAMEs. If
                the author of that page is not aware of that fact then it is not
                surprising that he/she has wondered off into a world of stupid
                workarounds and UA branching code to try and mitigate for their
                evident ignorance. It happens all the time, but that does not make
                following a good idea.
                With my original question I was hoping to hear what experts think if
                they are familiar with what I am asking.
                This went the wrong way, so let me state the problem I personally had.
                I created a mechanism to upload images keeping the user on one page.
                The form would submit image files into dynamically created IFRAME. I
                developed this in Firefox but when I started testing IE6 form was not
                able to submit to my hidden IFRAME: it did not see it... This form's
                target was IFRAME's name.
                When I did some research I discovered that if I create IFRAME like
                this for IE6 (document.creat eElement('<ifra me src="#">')) then it
                would work for me and it did.
                That's why I am wondering why it happened and is it something I should
                be better off using for IE6 or less?
                Thanks

                Comment

                • Thomas 'PointedEars' Lahn

                  #9
                  Re: Whta's the Story with document.create Element('iframe ') in IE?

                  vunet wrote:
                  I created a mechanism to upload images keeping the user on one page.
                  The form would submit image files into dynamically created IFRAME. I
                  developed this in Firefox but when I started testing IE6 form was not
                  able to submit to my hidden IFRAME: it did not see it... This form's
                  target was IFRAME's name.
                  When I did some research I discovered that if I create IFRAME like
                  this for IE6 (document.creat eElement('<ifra me src="#">')) then it
                  would work for me and it did.
                  Talk is cheap. Show me the code.
                  -- Linus Torvalds
                  That's why I am wondering why it happened and is it something I should
                  be better off using for IE6 or less?
                  You are asking all the wrong questions.
                  <http://catb.org/~esr/faqs/smart-questions.html>

                  Again, please trim your quotes.


                  PointedEars
                  --
                  Prototype.js was written by people who don't know javascript for people
                  who don't know javascript. People who don't know javascript are not
                  the best source of advice on designing systems that use javascript.
                  -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

                  Comment

                  • Laurent vilday

                    #10
                    Re: Whta's the Story with document.create Element('iframe ') in IE?

                    vunet :
                    It is recommended by some sources I found to create IFrames in IE
                    What sources ?
                    using document.create Element('<ifram e src="#">')
                    instead of document.create Element('iframe ').
                    Are you sure it is the "src" attribute the problem ? This is not the
                    issue I am aware of.
                    <http://msdn.microsoft. com/en-us/library/ms536389.aspx>
                    <quote>
                    Attributes can be included with the sTag as long as the entire string
                    is valid HTML. To include the NAME attribute at run time on objects
                    created with the createElement method, use the sTag .
                    </quote>

                    This code will *not* "work" in IE6 or IE7, but will in IE8b2

                    <a href="http://www.google.fr" target="myIfram e">link</a>
                    <script type="text/javascript">
                    var iframe = document.create Element('iframe ');
                    iframe.name = 'myIframe';
                    document.body.a ppendChild(ifra me);
                    </script>

                    This code will "work" in IE6 and IE7, but will *not* in IE8b2

                    <a href="http://www.google.fr" target="myIfram e">link</a>
                    <script type="text/javascript">
                    var iframe = document.create Element('<ifram e name="myIframe" >');
                    iframe.name = 'myIframe';
                    document.body.a ppendChild(ifra me);
                    </script>

                    As you can see (once tested), the issue IE6 can encounter is related to
                    the name attribute of the newly created element, I have tested with your
                    src workaround and I can't find any other issue than the "name" one.

                    So, are you really sure about the src="#" workaround ?

                    --
                    laurent

                    Comment

                    • Henry

                      #11
                      Re: Whta's the Story with document.create Element('iframe ') in IE?

                      On Sep 9, 5:17 pm, vunet wrote:
                      <snip>
                      With my original question I was hoping to hear what experts
                      think if they are familiar with what I am asking.
                      When you get round to asking a question that can be answered you might
                      get an answer.
                      This went the wrong way, so let me state the problem I
                      personally had.
                      The problem, or the symptoms of a problem that you never managed to
                      pin down?
                      I created a mechanism to upload images keeping the user on
                      one page. The form would submit image files into dynamically
                      created IFRAME. I developed this in Firefox but when I started
                      testing IE6 form was not able to submit to my hidden IFRAME:
                      Symptom!
                      it did not see it...
                      You mean a form with a TARGET attribute did not (POST) submit in such
                      a way that the response was received as the new contents of an IFRAME
                      with a corresponding NAME attribute?

                      I POST forms to dynamically created named/IDed IFRAMEs in IE 6+ all
                      the time, so your inability to do so certainly does not indicate that
                      it is impossible.
                      This form's target was IFRAME's name.
                      But was it? The balance of probability is that you attempted to use -
                      setAttribute - to set the NAME attribute, and that has never worked
                      well on IE (for any elements).
                      When I did some research I discovered that if I create
                      IFRAME like this for IE6
                      (document.creat eElement('<ifra me src="#">')) then it
                      would work for me and it did.
                      I think there should be a name attribute in that mark-up, but still it
                      is not needed.
                      That's why I am wondering why it happened and is it something
                      I should be better off using for IE6 or less?
                      If you want to know why some script did not work then you should show
                      that script. Describing it only goes so far, and usually leaves the
                      impression that some programmer error has been made but is not going
                      to be recognised by the programmer responsible and so will never be
                      included in any description.

                      Comment

                      • Henry

                        #12
                        Re: Whta's the Story with document.create Element('iframe ') in IE?

                        On Sep 9, 6:04 pm, Laurent vilday wrote:
                        <snip>
                        This code will *not* "work" in IE6 or IE7, but will in IE8b2
                        >
                        <a href="http://www.google.fr" target="myIfram e">link</a>
                        <script type="text/javascript">
                        var iframe = document.create Element('iframe ');
                        iframe.name = 'myIframe';
                        document.body.a ppendChild(ifra me);
                        </script>
                        <snip>

                        How are you defining "*not* work" in that case? The code, when pasted
                        into a simple HTML page, produces the IFRAME just fine in IE 6, and
                        that is pretty much all it has been coded to do.

                        (The handling of name attributes is pretty much an irrelevance if you
                        never attempt to do anything that relates to them.)

                        Comment

                        • Laurent vilday

                          #13
                          Re: Whta's the Story with document.create Element('iframe ') in IE?

                          Henry a écrit :
                          On Sep 9, 6:04 pm, Laurent vilday wrote:
                          <snip>
                          >This code will *not* "work" in IE6 or IE7, but will in IE8b2
                          >>
                          ><a href="http://www.google.fr" target="myIfram e">link</a>
                          ><script type="text/javascript">
                          >var iframe = document.create Element('iframe ');
                          >iframe.name = 'myIframe';
                          >document.body. appendChild(ifr ame);
                          ></script>
                          <snip>
                          >
                          How are you defining "*not* work" in that case? The code, when pasted
                          into a simple HTML page, produces the IFRAME just fine in IE 6, and
                          that is pretty much all it has been coded to do.
                          Well, I though it was obvious to reproduce but you are right it needs
                          more explanation to understand what needs to be done to reproduce the
                          problem.

                          1) Browse the HTML code
                          2) Click on the link

                          For IE6 and 7, the iframe appears correctly on the document, but the
                          link '<a href="xx" target="myIfram e">' is not opening the href in the
                          targeted iframe but in the whole document.
                          (The handling of name attributes is pretty much an irrelevance if you
                          never attempt to do anything that relates to them.)
                          Pff, I really though it was obvious for anyone reading the html,
                          especially from clj readers since this *name* issue in dynamically
                          created element is far (*very* far) from being a new thing.

                          There is a link to a target (myIframe) and there is a dynamically
                          created iframe with a dynamic name attribute (myIframe), don't you see
                          something relevant ?

                          Anyway I'm so bored of playing games here, EOD.

                          --
                          laurent

                          Comment

                          • Laurent vilday

                            #14
                            Re: Whta's the Story with document.create Element('iframe ') in IE?

                            Henry a écrit :
                            On Sep 9, 5:17 pm, vunet wrote:
                            <snip>
                            >With my original question I was hoping to hear what experts
                            >think if they are familiar with what I am asking.
                            >
                            When you get round to asking a question that can be answered you might
                            get an answer.
                            Oh come on ! Do you really need to be another PointedEars ?
                            You mean a form with a TARGET attribute did not (POST) submit in such
                            a way that the response was received as the new contents of an IFRAME
                            with a corresponding NAME attribute?
                            >
                            I POST forms to dynamically created named/IDed IFRAMEs in IE 6+ all
                            the time, so your inability to do so certainly does not indicate that
                            it is impossible.
                            LOL, really without any IE6/IE7 hack ? I doubt it. No, sorry, I have no
                            doubt, I *know* by experience it is a lie.

                            Read *very* carefully this document :
                            <http://msdn.microsoft. com/en-us/library/ms536389.aspx>
                            <quote>
                            Attributes can be included with the sTag as long as the entire string is
                            valid HTML. To include the NAME attribute at run time on objects created
                            with the createElement method, use the sTag .
                            </quote>

                            In IE6 and IE7, if you have to use the name attribute of a dynamic
                            element inserted into the document, you *must* declare the name
                            attribute of the element when calling document.create Element(). After is
                            too late.

                            in IE6 and IE7 :
                            var input = document.create Element('<input name="myInput"> ');
                            var iframe = document.create Element('<ifram e name="myIframe" >');

                            Anywhere else :
                            var input = document.create Element('input' );
                            input.name = 'myInput';
                            var iframe = document.create Element('iframe ');
                            iframe.name = 'myIframe';

                            Period.

                            --
                            laurent

                            Comment

                            • vunet

                              #15
                              Re: Whta's the Story with document.create Element('iframe ') in IE?

                              >
                              In IE6 and IE7, if you have to use the name attribute of a dynamic
                              element inserted into the document, you *must* declare the name
                              attribute of the element when calling document.create Element(). After is
                              too late.
                              >
                              in IE6 and IE7 :
                              var input = document.create Element('<input name="myInput"> ');
                              var iframe = document.create Element('<ifram e name="myIframe" >');
                              >
                              Anywhere else :
                              var input = document.create Element('input' );
                              input.name = 'myInput';
                              var iframe = document.create Element('iframe ');
                              iframe.name = 'myIframe';
                              Is this the answer I was looking for? Thanks Laurent, I've been
                              through all this dirt from other 'experts' but finally got what I
                              need.

                              Comment

                              Working...