Wednesday, February 9, 2011

The problem i faced with jqGrid and IE

Ok first of all before i start let me say this was not a problem with jqGrid or IE. I just started using jqGrid (hats off to the development team for the comprehensive documentation) in one of my projects i do in my free time. All was going well and i tested it out in IE7/8,FF2/3 and chrome. But i made a common mistake of not testing it in IE 6. When i went to deploy this at the clients environment alas it was IE 6. And the page i was using the jqGrid loaded and showed the message

Internet Explorer cannot open the Internet site http://<web site="">.com. Operation aborted.

I was baffled as to what this was. Debugging code at the client's environment was a pain. So as a work around i installed firefox for the moment until i found out what the issue was.

Went home, fired up note pad ++ and google of course :) .. in one site it mentioned that this could be the cause of a child element trying to modify a parent element. But i didnt find anything of such in my code.
In the path of an answer i saw that IE 8 was also giving the same error message but as a warning which didnt catch my eye. so i checked what that error was. it was as such;


Yikes now why didnt i see that first before my visit to the client. Oh well. So looking at the code, note that this was the only page that gave the problem and it was the only place where jqGrid was used. Looking at the DOM again i caught up with a code snippet of mine as such;


<div style="padding:10px 0 0 30px;">
    <table id="list2"></table> 
    <div id="pager2"/>
</div>

I saw the pager2 div didnt have a </div> element as i have just closed it within the same element it was defined. So hence i changed the following code as such;

<div style="padding:10px 0 0 30px;">
   <table id="list2"></table> <div id="pager2"></div>
   </div>
WAM!!! the bug dissapeared. So it seems that every div should be closed with a separate close div element rather than within the same opening tag although it doesnt have any content.

Now im not sure why that is. I Googled about it but didnt find any results as to why that happens. Maybe if you guys know the answer please do leave by a comment which would be highly appreciated.

Hope this helps any other person who would face a similar situation.

Cheers and happy coding to all !!!!!