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.