Posted By: yman | Jul 13th, 2006 @ 8:19 AM
page 1 of 1
Comments: 23 | Views: 44801
I am developing an ajax web app. I work against FireFox and then test it against IE, normally much later.
The app works fine in FF, all the xmlhttp requests work etc. But when I try it in IE I am just prompted with an "Operation Aborted" message half way into the initial page load. It loads about half of the page and then just fires the message.

Any ideas of how to debug this or determine why it would flag this error?

edit:
This behaviour is present in IE6 and IE7... not just the betas
DMassy
DMassy
Driving!
yman wrote:
I am developing an ajax web app. I work against FireFox and then test it against IE, normally much later.
The app works fine in FF, all the xmlhttp requests work etc. But when I try it in IE I am just prompted with an "Operation Aborted" message half way into the initial page load. It loads about half of the page and then just fires the message.

Any ideas of how to debug this or determine why it would flag this error?

edit:
This behaviour is present in IE6 and IE7... not just the betas


Can you provide a page that will reproduce the problem? Without that it is difficult to know exactly what is causing the problem.

Thanks
-Dave
DMassy
DMassy
Driving!
yman wrote:
Well it appears that the problem is triggered by certain behaviours in relation to elements being appended to the dom.

The following html/js will flag an operation aborted error: (tested in IE7 beta 3)
 
<table>
   <tr>
    <td>
     <script type="text/javascript">
      var d = document.createElement('div');
      document.body.appendChild(d);
     </script>
    </td>
   </tr>
  </table

An example of this can be found here

The following code html/js wil not: (again in IE7 b3)

<div>
     <script type="text/javascript">
var d = document.createElement('div');
document.body.appendChild(d);
</script>
</div>

An example of this can be found here


I hope there is an easy work around for this.


Interesting. Is there any particular reason to put a Script block inside a table cell?

Thanks
-Dave
DMassy
DMassy
Driving!
yman wrote:
Well it appears that the problem is triggered by certain behaviours in relation to elements being appended to the dom.

The following html/js will flag an operation aborted error: (tested in IE7 beta 3)
 
<table>
   <tr>
    <td>
     <script type="text/javascript">
      var d = document.createElement('div');
      document.body.appendChild(d);
     </script>
    </td>
   </tr>
  </table

An example of this can be found here

The following code html/js wil not: (again in IE7 b3)

<div>
     <script type="text/javascript">
var d = document.createElement('div');
document.body.appendChild(d);
</script>
</div>

An example of this can be found here


I hope there is an easy work around for this.


Interesting. Is there any particular reason to put a Script block inside a table cell?

Thanks
-Dave
DMassy
DMassy
Driving!
yman wrote:
Well it appears that the problem is triggered by certain behaviours in relation to elements being appended to the dom.

The following html/js will flag an operation aborted error: (tested in IE7 beta 3)
 
<table>
   <tr>
    <td>
     <script type="text/javascript">
      var d = document.createElement('div');
      document.body.appendChild(d);
     </script>
    </td>
   </tr>
  </table

An example of this can be found here

The following code html/js wil not: (again in IE7 b3)

<div>
     <script type="text/javascript">
var d = document.createElement('div');
document.body.appendChild(d);
</script>
</div>

An example of this can be found here


I hope there is an easy work around for this.


Interesting. Is there any particular reason to put a Script block inside a table cell?

Thanks
-Dave
DMassy
DMassy
Driving!
yman wrote:
DMassy, do you have any ideas on how to control this problem?


Can you put your script blocks in the head of the page not in the middle of a TD element?
DMassy
DMassy
Driving!
yman wrote:
As I mentioned 3 posts up, I dont personally do that. I used that as an example (I found the example via googling) because I couldn't post my own code, yet.


Sorry. It is not clear from your post what you can control and what sort of workaround you are looking for.

The issue appears to be that you are trying to append a child to the end of the body before we have completed parsing that element. That causes things to get a little confused. One possibility is to put defer='true' on script elements so they run after the body has been parsed and the element tree built.
If you can avoid trying to append something to something that is not yet built then it shoudl solve the issue.

Thanks
-Dave
The way Google used to suggest you use their map API leads very easily to putting snippets of JavaScript into the markup tree. (They seem to have updated their code examples.) That's how I got to this thread.
yman wrote:

I suppose it is partly my fault for developing against FF


It's probably a good idea to test with multiple browsers all along the development cycle. But to say it's partly *your fault* would be to underplay the gross mishandling of the IE project on the part of Microsoft.
PaoloM
PaoloM
Hypermediocrity
dphiffer wrote:
But to say it's partly *your fault* would be to underplay the gross mishandling of the IE project on the part of Microsoft.

According to the XHTML 1.0 Transitional DTD, <script> elements are allowed only inside the <head> element.

<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">

Both FireFox and IE allow for some latitude with malformed markup and, given that's not a part of the official spec, any implementor can do whatever they want with it.

So FireFox is "grossly mishandling" this feature as much as IE is doing it.
Hi all!

But what is with the ASP.Net engine? When you register any script in the Page it will be written into the body element (inside the form).

From this view, you will never be able to make a valid page with ASP.Net.

Does anyone have suggestions for this one? Expressionless

Patrick
stevo_
stevo_
Maim that tune
Implement a new Page class that handles script registers (such as webresource.axd) into this block. I thought about doing this a while ago, so you had a more literal working page.

Html
-Head
-Body

Or something like...

<asp:HtmlDocument runat="server">
  <asp:HtmlHead>
    <meta />
  </asp:HtmlHead>
  <asp:HtmlBody>
    <p>blah</p>
  </asp:HtmlBody>
</asp:HtmlDocument>

Of course this structure is pretty strict, but so is xhtml, and its not designed as a page replacement, only an extension designed for strict xhtml pages written as this format.

You could run a 'resource' kinda service into the web.config so that you can 'include' HtmlHead parts (such as meta tag collections).
This is not that easy!

Every, I mean every thrid party library uses the ASP.Net stuff like "RegisterScriptInclude" or whatever. You will always have this problem with aspx. Microsoft did a very sleazy job with that.... sorry.

Greets
Patrick
stevo_
stevo_
Maim that tune
Well, RegisterScriptBlock is handled back to the Page class surely?, so if you inherit Page and override RegisterScriptBlock, you can manage how scripts are placed in the page?
Have a look here:

http://www.wayki.com/themes/test.html

It fails because the script is in a <form> element. There can be lots of HTML after the script, it doesn't matter. It just can't be in the <form> with is bad since the <form> covers the whole page!

Issue with IE6 and IE7. All versions that I checked.
#yman

can you give further details of how you fixed this? I am in the same boat as you were and can't find any solutions... my js code is long and complicated so finding the error is at least 10 hards.
page 1 of 1
Comments: 23 | Views: 44801
Microsoft Communities