Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.
Request header parsing
Does anyone know a good way to get the request header details using javascript? I had a quick go with ajax and its xmlhttprequest class, but I couldnt get it to work for me. Its worth noting I want to read the request headers, not the response headers.
Id much prefer a simple javascript DOM affair, but other than document.cookie I cant seem to find one for the other request headers. The AJAX code im using now is:
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("HEAD", "<url>",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.getAllResponseHeaders());
}
}
xmlhttp.send(null)
</script>
Am I on the right track with AJAX, or am I gonna need something else?
Ok, i found this on a site, not sure but worth a try
<script language="JavaScript"><!--
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var dateSent = null;
var dateComplete = null;
function RetrieveHTTPHeaders(url)
{
if (chkHEAD.checked)
xmlhttp.open("HEAD", "http:\/\/" + url, true); // Request just the header in an asynchronous call
else
xmlhttp.open("GET", "http:\/\/" + url, true); // Request all in an asynchronous call
xmlhttp.onreadystatechange = HandleState;
xmlhttp.setRequestHeader("pragma", "nocache");
dateSent = new Date();
xmlhttp.send("");
}
function HandleState()
{
var state = xmlhttp.readyState;
if (state == 1)
{
btnSubmit.disabled = true;
Status.innerText="";
Result.innerText="";
Body.innerText="";
ResponseTime.innerText="";
}
else if (state == 4)
{
dateComplete = new Date();
Status.innerText = xmlhttp.statusText + " (" + xmlhttp.status + ")";
Result.innerText = xmlhttp.getAllResponseHeaders();
Body.innerText = xmlhttp.responseText;
ResponseTime.innerText = ((dateComplete.valueOf() - dateSent.valueOf())/1000) + " seconds";
btnSubmit.disabled = false;
}
}
--></script>
And this is the site http://www.whirlywiryweb.com/articles/getheaders.html