-
how to get header information of a website???
var req = new XMLHttpRequest();
req.open('GET', 'http://localhost/gp/index.php', false);
req.send(null);
if(req.status == 200) {
alert(req.getResponseHeader('Content-type'));
alert(req.getAllResponseHeaders());
this code is working fine and giving the HEADER information;but if i change the URL and put http://www.google.com, then it is not working.........plzzzz i need help.
-
RE: how to get header information of a website???
Here is the code i tried with. It is running with other url but not with google. There may be some security risk for which you are not getting the result you want.
<script>
function xmlhttpPost()
{
var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('GET', 'http://www.yahoo.com', true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4 && self.xmlHttpReq.status == 200) {
alert("Successful!");
}
}
self.xmlHttpReq.send();
}
xmlhttpPost();
</script>
I hope this will help you
Similar Threads
-
By tx12345 in forum VB Classic
Replies: 2
Last Post: 03-08-2007, 08:57 PM
-
By zdrsoft in forum Security
Replies: 4
Last Post: 01-11-2007, 07:19 AM
-
By john moyers M.D., PhD in forum Web
Replies: 0
Last Post: 06-04-2002, 09:12 AM
-
By Edwin Gomez in forum Talk to the Editors
Replies: 0
Last Post: 04-26-2002, 12:08 PM
-
Replies: 3
Last Post: 03-07-2001, 10:22 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks