Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Content type check

Status
Not open for further replies.

c3f8

Programmer
Jul 16, 2007
8
PT
Hi!!

Is there anyway of getting page content-type in client-side using javascript?

thanks
 
I don't think this possible using Javascript. I've certainly never seen it done - and looking in the navigator object (where it might have been) shows nothing.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
i was able to get information using mozilla but not in ie.

thanks.

 
I've been thinking about this a little more over the weekend...

You could get the headers of an AJAX request using getResponseHeader("content-type") on the XHRequest object. Note this will not work with the file:// prototcol (so do it against a proper web server). So you could file off a simple XHR using javascript - and interrogate the headers that way.

Just a thought!

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top