The following are scripting examples of content negotiation using the HTTP Accept header.

These examples are used to properly serve XHTML with the proper MIME media type of application/xhtml+xml. If the request header does not allow this media type, it will be served as text/html. This convention follows the W3C standard for “Recommended Media Type Usage:” See the examples