Monday, June 13, 2011

AJAX - returning of bulk content problem

    Problem :
                Large amount of content not displayed while using AJAX textnode in mozilla, opera and netscape
    Solution :
                The server will divide
large text node data into more small parts before sending to browsers. So we need to accumulate all the parts to get complete data.
           
    Note:    Mozilla/Firefox/Netscape 6+ and Opera 9.2x- will split very long text nodes into multiple smaller text nodes. 
            In Opera 7-9.2x, this maximum text node size is 32 KB. In Mozilla/Firefox/Netscape 6+, it is 4 KB. Although the normalize() method of the parent node(s) should be able to replace the multiple text nodes with a single text node containing all the text, this only works in Mozilla/Firefox/Netscape 6+. In Opera 7-9.2x it puts all of the text into a single node and then truncates that node to 32 KB, so the contents of all except the first node are lost. Running the normalize method can crash Internet Explorer 6 and does not exist in Internet Explorer 5 on Windows.
            So combine all the small parts received to get the full contents like,
       
                var root = resxml.getElementsByTagName("groupdetails")[0];
                var innerhtml = "";
                for(index = 0; index < root.childNodes.length; index++){
                    innerhtml +=  root.childNodes[index].nodeValue;
                }
                if(obj = cmda.$id("div_grpdet"))        obj.innerHTML =    innerhtml;

No comments:

Post a Comment