views:

435

answers:

2

OS: Linux Browser : Firefox

I need to read a html file content into a string variable through JavaScript ?

Is it possible in javascript ? If yes, Kindly help me with syntax/method to do this

+1  A: 

The easiest solution is probably to use the JQuery library.

http://docs.jquery.com/Ajax/jQuery.get

$.get("mypage.html", function(data){
  alert("Data Loaded: " + data);
});
Thomas Stock
A: 

I think that this should do the trick. It's untested but give it a try.

document.documentElement.innerHTML

Another approach could be to query the URL through XmlHttpRequest and read the response.responseText

Laurent Villeneuve
Can you give me link to more detailed document for above