error in IE with CDATA inside javascript script

T

TriAdmin

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!
 
J

Janwillem Borleffs

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
 
T

TriAdmin

Janwillem Borleffs said:
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!!
 
S

Stevo

TriAdmin said:
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.
 
T

TriAdmin

Stevo said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,201
Latest member
KourtneyBe

Latest Threads

Top