Ajax get all Response Header
Response Header Example
This section contains the Ajax example for getting all header information about a resource, resource may be PHP page, JSP page or simple html page etc.
<!DOCTYPE html> <html> <head> <script> function loadXMLDoc(url) { var u; if (window.XMLHttpRequest) { u=new XMLHttpRequest(); } else { u=new ActiveXObject("Microsoft.XMLHTTP"); } u.onreadystatechange=function() { if (u.readyState==4 && u.status==200) { document.getElementById('uk').innerHTML= u.getAllResponseHeaders(); } } u.open("GET",url,true); u.send(); } </script> </head> <body> <h1>All the header detail of the file</h1> <div id="uk"></div> <button onclick="loadXMLDoc('GetALLheader.html')"> Loas header info</button> </body> </html>
GetALLheader.html FILE
<html> <h1> This is index file</h1> </html>