Possible Duplicate:
Can Javascript read the source of any web page?
Can somebody please guide me to write a javascript snippet that fetches page details i.e page title,body content,and images just from link.
Well i have wrote a javascript that fetches source code from the posted link.I can always use getElementBytagName to get the required tags.I just wanted to know if there is a better way to do so.
<html>
<head>
<script type="text/javascript">
function changed(obj)
{
get_information(obj.value);
}
function get_information(link)
{
var xhr
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xhr=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xhr=new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.open("GET", link, true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4)
{
alert(xhr.responseText);
}
};
xhr.send(null);
}
</script>
</head>
<body>
<input type="text" onchange="changed(this)"/>
</body>
</html>
no i dont want the same page to be edited,i need to fetch the other page details from its link