Link to home
Start Free TrialLog in
Avatar of aspsue
aspsue

asked on

How can I display the header information using JavaScript in my HTML page?

I want to display the Header information in an HTML page I have.  I need to see if the Header information displays error numbers, such as 500 errors.

How can I do this in JavaScript?

Cheers,
Sue
Avatar of applekanna
applekanna

what are u using JSP /ASP

if ASP http://www.4guysfromrolla.com/webtech/121400-1.shtml

if JSP <%String head = request.getHeader() ;%>
Is this what you mean?

<html>
<head>
<title>New Page 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>
<script>
   document.write(this.GENERATOR.content)
   document.write(document.title)
</script>
<body>
</body>
</html>
um... something like this?

<html>
<head>
<title>Display stuff</title>
</head>
<script type='text/javascript'>
  var val = document.getElementsByTagName('head')[0].outerHTML
  val = val.replace(/</g,"&lt;")
  val = val.replace(/>/g,"&gt;")
  document.write(val)
</script>
<body>
HI
</body>
</html>

{Slam}
somethign like this:
var test  = "http://oldlook-search.experts-exchange.com/care/"
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")

xmlhttp.open("HEAD", test,true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   if (xmlhttp.status==200) alert(xmlhttp.status + "URL Exists!")
    else if (xmlhttp.status==404) alert(xmlhttp.status + "URL doesn't exist!")
     else alert("Status is "+xmlhttp.status)
  }
 }
 xmlhttp.send(null)
Avatar of aspsue

ASKER

These suggestions do not answer my question.

I need a javascript that i can put in my custom error page that will show the HTTP header information.  This the system header information that is sent to the page.

Cheers,
Sue
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial