error in IE with CDATA inside javascript script

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

    error in IE with CDATA inside javascript script

    I am trying to debug a client's Javascript inside a php page. It runs fine
    in Firefox but throws an error is IE, "can not open site,... operation
    aborted."

    The code starts like this:

    HTML Code:
    <script type="text/javascript">
    //<![CDATA[

    ....then there's a lot of script that works fine in here

    //]]>
    </script>I have used the php exit;function to diagnose the error. I think,
    is at the ending of the javascript because if I:

    HTML Code:
    //]]>
    <? exit ?>
    </script>it runs ok. Without the <? exit ?>, it fails.

    Any ideas? I've spent a lot of time on this and would really appreciate your
    help!


  • Janwillem Borleffs

    #2
    Re: error in IE with CDATA inside javascript script

    TriAdmin schreef:
    HTML Code:
    //]]>
    <? exit ?>
    </script>it runs ok. Without the <? exit ?>, it fails.
    >
    Any ideas? I've spent a lot of time on this and would really appreciate your
    help!
    >
    And what happens after the exit?


    JW

    Comment

    • TriAdmin

      #3
      Re: error in IE with CDATA inside javascript script

      "Janwillem Borleffs" <jw@jwscripts.c omwrote in message
      news:48047d6a$0 $54558$dbd4f001 @dr4.euro.net.. .
      TriAdmin schreef:
      >HTML Code:
      >//]]>
      ><? exit ?>
      ></script>it runs ok. Without the <? exit ?>, it fails.
      >>
      >Any ideas? I've spent a lot of time on this and would really appreciate
      >your help!
      >>
      >
      And what happens after the exit?
      >
      >
      JW
      JW - with the exit, the page displays but the ajavscript doe snot completely
      work, in IE only. In Firefox, it works as is.

      The javascript is at the bottom of the page but before the footer. I am used
      to javascript being in the header. As I said, I inherited this app.

      This page works as is in both IE and firefox in several other parts of the
      site but I am having trouble diagnoing where in the javascript it is causing
      the error. Any hints on debugging javascript in Firefox? Any extensions?

      Many thanks for any ideas to help this client out!!


      Comment

      • Stevo

        #4
        Re: error in IE with CDATA inside javascript script

        TriAdmin wrote:
        The javascript is at the bottom of the page but before the footer. I am used
        to javascript being in the header. As I said, I inherited this app.
        >
        This page works as is in both IE and firefox in several other parts of the
        site but I am having trouble diagnoing where in the javascript it is causing
        the error. Any hints on debugging javascript in Firefox? Any extensions?
        The "internet operation aborted" error in my experience usually comes
        from code that's trying to add elements to the DOM (using for example
        insertBefore or appendChild) before the page is finished loading
        (document.ready State=="complet e"). Internet Explorer is the only browser
        that can't handle adding to the DOM in this way. You can sometimes get
        away with adding stuff to the DOM when the document.readyS tate has
        reached as far as the "interactiv e" state, but even that has some risk.
        If I'm right, and your JavaScript is adding to the DOM during parsing,
        you could alert the value of the readyState at the point at which you
        were just about to add stuff to the DOM using
        alert(document. readyState). I bet you'll find it's in one of the other
        states. I don't recall all the states but I think two of them are
        "initializi ng" and "loading". Either of these would be a bad time to be
        adding to the DOM except with inline tags and/or document.write.

        Comment

        • TriAdmin

          #5
          Re: error in IE with CDATA inside javascript script

          "Stevo" <no@mail.invali dwrote in message
          news:fu21n0$a0e $01$1@news.t-online.com...
          TriAdmin wrote:
          >The javascript is at the bottom of the page but before the footer. I am
          >used to javascript being in the header. As I said, I inherited this app.
          >>
          >This page works as is in both IE and firefox in several other parts of
          >the site but I am having trouble diagnoing where in the javascript it is
          >causing the error. Any hints on debugging javascript in Firefox? Any
          >extensions?
          >
          The "internet operation aborted" error in my experience usually comes from
          code that's trying to add elements to the DOM (using for example
          insertBefore or appendChild) before the page is finished loading
          (document.ready State=="complet e"). Internet Explorer is the only browser
          that can't handle adding to the DOM in this way. You can sometimes get
          away with adding stuff to the DOM when the document.readyS tate has reached
          as far as the "interactiv e" state, but even that has some risk. If I'm
          right, and your JavaScript is adding to the DOM during parsing, you could
          alert the value of the readyState at the point at which you were just
          about to add stuff to the DOM using alert(document. readyState). I bet
          you'll find it's in one of the other states. I don't recall all the states
          but I think two of them are "initializi ng" and "loading". Either of these
          would be a bad time to be adding to the DOM except with inline tags and/or
          document.write.
          many thanks, I will try that now


          Comment

          Working...