Hi all,

Can anyone explain how to parse a html file at the client side that we got as a response from the server?
Please provide me good websites for doing this task.

Thanks in advance.


What do you need to do? I'm sorry, but the question seems a bit vague.

hi buddy

Here is my explanation:

I will get a html response from a server when I click a button at the client side.Now that html file should be displayed in the client side with font,style,color every thing applied as per the client side.
I want to do in java script.Am able to display the html file by using the following js function:

function getBody(content) 
	   test = content.toLowerCase();    // to eliminate case sensitivity
	   var x = test.indexOf("<form");
	   if(x == -1) return "";

	   x = test.indexOf(">", x);
	   if(x == -1) return "";

	   var y = test.lastIndexOf("</form>");
	      if(y == -1) y = test.lastIndexOf("</html>");
	   if(y == -1) y = content.length;    // If no HTML then just grab everything till end

	   return content.slice(x + 1, y);   


if(req.readyState == 4)
				main.innerHTML = getBody(req.responseText);

But the formatting is not proper at the server side and we at the client side should do it...I want to know how to format html response, add breaks wherever needed at the client side.

I think I have explained a bit specific....


You are saying you have a separate client software application - not a browser - that has a javascript engine? You want to display the HTML "per the client side"

Why not just use a browser - if you are interested in displaying HTML? What other requirements to do you have for how the HTML is rendered?