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
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
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);
});
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