开发者

Why does my COMET control throw a javascript error when IE8 closes?

I've written a COMET/Reverse Ajax table control in ASP.NET. The javascript part uses jQuery (1.3.2). It seems to be working OK, apart from when closing the browser in IE (8). It's only when IE is closed that I get the error. Firefox and Chrome don't throw an error. In this case it throws a

Microsoft JScript runtime error: Object doesn't support this property or method

The control is a descendent of System.Web.UI.WebControls.Table.

The offending line is:

var currentCell = $("#" + gridName + " tr:nth-child(" + (rowIndex + 1) + ") td:nth-child(" + (cellIndex - rowIndex * columnCount + 1) + ")");

gridName is the ID of the control which is passed into the function as a parameter. The function containing this line is called in response to a successful Ajax POST request.

The control works as expected while the page is open.

I'm assuming the problem is the result of something being removed when the browser closes, so the outstanding Ajax request fails when it returns. However this is just a guess - I'm not that familiar with jQuery. I tried setting a flag in the window.unload event to prevent the offending code being called after the 开发者_如何学JAVAunload event occurs, but this didn't solve the problem.

I'm not using any Javascript libraries other than jQuery. The javascript is include as a WebResource.

The problem does not occur when I navigate to a new page - only when the browser is closed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜