Set Encoding Dynamically in IE6 Instead of Enctype

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

    Set Encoding Dynamically in IE6 Instead of Enctype

    My form uploads files by submitting them to hidden IFrame. I set
    enctype "multipart/form-data" dynamically. This works great everywhere
    but IE6.
    I discovered that in IE6 I need to set encoding instead of enctype. So
    I built the following:


    if(document.all ) form.encoding = "multipart/form-data";
    else form.enctype = "multipart/form-data";
    form.submit();
    if(document.all ) form.encoding = "";
    else form.enctype = "";

    But after submitting, form encoding property cannot be found. How do I
    handle this process correctly?
    Thanks.
  • Eric B. Bednarz

    #2
    Re: Set Encoding Dynamically in IE6 Instead of Enctype

    vunet <vunet.us@gmail .comwrites:
    I discovered that in IE6 I need to set encoding instead of enctype. So
    I built the following:
    if(document.all ) […]
    For educational purposes, I would start with doing the following in
    Opera 9, Safari 3 and Firefox 1+ (the latter in backcompat mode):

    window.onload = function () {
    if (!document.all) {
    alert(Array.pro totype.slice.ca ll(document.all ));
    }
    };


    --
    ||| hexadecimal EBB
    o-o decimal 3771
    --oOo--( )--oOo-- octal 7273
    205 goodbye binary 111010111011

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Set Encoding Dynamically in IE6 Instead of Enctype

      vunet wrote:
      My form uploads files by submitting them to hidden IFrame. I set
      enctype "multipart/form-data" dynamically. This works great everywhere
      but IE6.
      I discovered that in IE6 I need to set encoding instead of enctype.
      Do you mean to say that the opposite of what is said in
      <http://msdn.microsoft. com/en-us/library/ms533745(VS.85) .aspxis true?
      So I built the following:
      >
      if(document.all ) form.encoding = "multipart/form-data";
      else form.enctype = "multipart/form-data";
      That's double nonsense because document.all is supported by MSHTML 4 and
      above, partially by Gecko 1.8.1 and above in Quirks Mode, by Opera, KHTML,
      and WebKit.

      <http://www.jibbering.c om/faq/faq_notes/not_browser_det ect.html#bdTop>
      form.submit();
      if(document.all ) form.encoding = "";
      else form.enctype = "";
      After the form was submitted, the `form' reference is invalid because
      another resource was navigated to (unless there is a 204 No Content response).
      But after submitting, form encoding property cannot be found. How do I
      handle this process correctly?
      Do not use object inference but perform feature tests, and do not use `form'
      after `form.submit()' . It is not necessary to reset anything anyway.


      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

      • Thomas 'PointedEars' Lahn

        #4
        Re: Set Encoding Dynamically in IE6 Instead of Enctype

        Eric B. Bednarz wrote:
        vunet <vunet.us@gmail .comwrites:
        >I discovered that in IE6 I need to set encoding instead of enctype. So
        >I built the following:
        >>
        >if(document.al l) […]
        >
        For educational purposes, I would start with doing the following in
        Opera 9, Safari 3 and Firefox 1+ (the latter in backcompat mode):
        >
        window.onload = function () {
        if (!document.all) {
        alert(Array.pro totype.slice.ca ll(document.all ));
        }
        };
        What educational purpose should this example serve -- how *not* to do things?

        1. `window.onload' is unnecessarily proprietary, given the existence of
        the `onload' attribute of the `body' element.

        2. As often discussed before, the first argument of Array.prototype .slice()
        is *not* specified as being optional: ToInteger(undef ined) is NaN which
        cannot be used in the algorithm (ES3F, 15.4.4.10).

        4. ToInteger(undef ined) == NaN [9.4]
        1. ToNumber(undefi ned) == NaN [9.3]
        5. If Result(4) is negative, use max((Result(3)+ Result(4)),0);
        else use min(Result(4),R esult(3)).
        min(NaN, ...)

        3. What educational purpose should slicing a *false*-value serve?

        4. "Whether the slice function can be applied successfully to a host
        object is implementation-dependent." (ibid.)


        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

        • vunet

          #5
          Re: Set Encoding Dynamically in IE6 Instead of Enctype


          Do you mean to say that the opposite of what is said in
          <http://msdn.microsoft. com/en-us/library/ms533745(VS.85) .aspxis true?
          >
          There is a Warning on that page where it states that encoding should
          be used instead of enctype when dynamically setting the multipart.
          So I built the following:
          >
          if(document.all ) form.encoding = "multipart/form-data";
          else form.enctype = "multipart/form-data";
          >
          That's double nonsense because document.all is supported by MSHTML 4 and
          above, partially by Gecko 1.8.1 and above in Quirks Mode, by Opera, KHTML,
          and WebKit.
          >
          <http://www.jibbering.c om/faq/faq_notes/not_browser_det ect.html#bdTop>
          Thanks for this. In fact I added that for demo purposes but normally I
          determine IE6 with document.all && !window.XMLHttp Request. If this is
          still conflicting with some non-IE browsers, please suggest your way.
          >
          form.submit();
          if(document.all ) form.encoding = "";
          else form.enctype = "";
          >
          After the form was submitted, the `form' reference is invalid because
          another resource was navigated to (unless there is a 204 No Content response).
          >
          But after submitting, form encoding property cannot be found. How do I
          handle this process correctly?
          >
          Do not use object inference but perform feature tests, and do not use `form'
          after `form.submit()' .  It is not necessary to reset anything anyway.

          I see what you say but I need to submit images separately to IFrame
          and then the form without multipart after. Does it mean that I am
          stuck here? Should I create additional forms to handle this?
          Thanks.
          >
          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 300d...@news.de mon.co.uk>

          Comment

          • Eric B. Bednarz

            #6
            Re: Set Encoding Dynamically in IE6 Instead of Enctype

            Thomas 'PointedEars' Lahn <PointedEars@we b.dewrites:
            Eric B. Bednarz wrote:
            >For educational purposes, I would start with doing the following in
            >Opera 9, Safari 3 and Firefox 1+ (the latter in backcompat mode):
            >>
            >window.onloa d = function () {
            > if (!document.all) {
            > alert(Array.pro totype.slice.ca ll(document.all ));
            > }
            >};
            >
            What educational purpose should this example serve -- how *not* to do things?
            It illustrates in the mentioned browsers (some people prefer that over
            unnecessarily verbose quotations and citations) that this kind of
            feature detection does not tell you anything by compactly alerting the
            contents of the document.all collection although it is true that
            document.all coerces to false.
            2. As often discussed before, the first argument of Array.prototype .slice()
            is *not* specified as being optional:
            It does not matter in this context, but that was indeed a rather stupid
            mistake.

            Beyond that you are so argumentative for its own sake that it is silly,
            at best.


            --
            ||| hexadecimal EBB
            o-o decimal 3771
            --oOo--( )--oOo-- octal 7273
            205 goodbye binary 111010111011

            Comment

            • Thomas 'PointedEars' Lahn

              #7
              Re: Set Encoding Dynamically in IE6 Instead of Enctype

              Eric B. Bednarz wrote:
              Thomas 'PointedEars' Lahn <PointedEars@we b.dewrites:
              >Eric B. Bednarz wrote:
              >>For educational purposes, I would start with doing the following in
              >>Opera 9, Safari 3 and Firefox 1+ (the latter in backcompat mode):
              >>>
              >>window.onlo ad = function () {
              >> if (!document.all) {
              >> alert(Array.pro totype.slice.ca ll(document.all ));
              >> }
              >>};
              >What educational purpose should this example serve -- how *not* to do things?
              >
              It illustrates in the mentioned browsers (some people prefer that over
              unnecessarily verbose quotations and citations) that this kind of
              feature detection does not tell you anything by compactly alerting the
              contents of the document.all collection although it is true that
              document.all coerces to false.
              Ahh, right. My bad. (There are better ways to show this, though.)


              PointedEars
              --
              Use any version of Microsoft Frontpage to create your site.
              (This won't prevent people from viewing your source, but no one
              will want to steal it.)
              -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

              Comment

              • vunet

                #8
                Re: Set Encoding Dynamically in IE6 Instead of Enctype

                On Oct 5, 7:39 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
                wrote:
                Eric B. Bednarz wrote:
                Thomas 'PointedEars' Lahn <PointedE...@we b.dewrites:
                Eric B. Bednarz wrote:
                >For educational purposes, I would start with doing the following in
                >Opera 9, Safari 3 and Firefox 1+ (the latter in backcompat mode):
                >
                >window.onloa d = function () {
                >  if (!document.all) {
                >    alert(Array.pro totype.slice.ca ll(document.all ));
                >  }
                >};
                What educational purpose should this example serve -- how *not* to do things?
                >
                It illustrates in the mentioned browsers (some people prefer that over
                unnecessarily verbose quotations and citations) that this kind of
                feature detection does not tell you anything by compactly alerting the
                contents of the document.all collection although it is true that
                document.all coerces to false.
                >
                Ahh, right.  My bad.  (There are better ways to show this, though.)
                >
                PointedEars
                --
                Use any version of Microsoft Frontpage to create your site.
                (This won't prevent people from viewing your source, but no one
                will want to steal it.)
                  -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
                I had a question here: how to handle dynamic setting of encoding to
                the form in IE6 and keep a reference to the form after it is submitted?

                Comment

                Working...