ContentType Property  
 
Returns the content type from the last server response.

Syntax

object.ContentType

Remarks

The ContentType property returns the MIME type reported by the server in the Content-Type response header for the most recent navigation. This value reflects the server's indication of what kind of content is being delivered, such as "text/html", "application/pdf", or "image/png". The returned string is preserved until the next navigation begins, even if the document is cleared or headers are reset.

It is important to note that not all servers will provide a Content-Type header. Some intentionally omit this information in combination with a X-Content-Type-Options: nosniff header as a security measure to prevent the client from "sniffing" or inferring the type. In such cases, ContentType will return an empty string. Applications should be prepared for this scenario and not assume a value will always be available.

Data Type

String

See Also