error in IE with CDATA inside javascript script

Discussion in 'Javascript' started by TriAdmin, Apr 15, 2008.

  1. TriAdmin

    TriAdmin Guest

    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!
     
    TriAdmin, Apr 15, 2008
    #1
    1. Advertising

  2. 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
     
    Janwillem Borleffs, Apr 15, 2008
    #2
    1. Advertising

  3. TriAdmin

    TriAdmin Guest

    "Janwillem Borleffs" <> wrote in message
    news:48047d6a$0$54558$...
    > 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!!
     
    TriAdmin, Apr 15, 2008
    #3
  4. TriAdmin

    Stevo Guest

    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.readyState=="complete"). 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.readyState has
    reached as far as the "interactive" 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
    "initializing" and "loading". Either of these would be a bad time to be
    adding to the DOM except with inline tags and/or document.write.
     
    Stevo, Apr 15, 2008
    #4
  5. TriAdmin

    TriAdmin Guest

    "Stevo" <> wrote in message
    news:fu21n0$a0e$01$-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.readyState=="complete"). 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.readyState has reached
    > as far as the "interactive" 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 "initializing" 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
     
    TriAdmin, Apr 15, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Davison
    Replies:
    1
    Views:
    635
    Hal Rosser
    Jul 7, 2004
  2. Neeraj Agrawal
    Replies:
    3
    Views:
    521
    Richard Tobin
    Oct 29, 2003
  3. Replies:
    3
    Views:
    797
    Joe Kesselman
    Mar 6, 2006
  4. sim.sim
    Replies:
    18
    Views:
    2,235
    Maksim Kasimov
    May 25, 2007
  5. sim.sim
    Replies:
    0
    Views:
    481
    sim.sim
    May 22, 2007
Loading...

Share This Page