Future to the fantasy ★ ★
Titania
X3D Editor
Version
3.0

X3D MIME Types and File Extensions

The MIME Type is used to indicate the media type of a file that is to be displayed over the internet. The web server typically uses the file extension as the indicator of the media type of the file. The MIME type is the key that a web browser uses to correctly interpret the bytes in a file so it is critical that the MIME type correctly reflect the media and encoding of the file.

For X3D developers this means they need to be aware of X3D file types and be able to set MIME Types on their own web server/host.

The base MIME type for X3D files is: model/x3d. Each file format has its own modifier. XML is +xml, Classic VRML is +vrml. The following table summarizes the file extension, MIME type, and X3D encoding:

X3D EncodingFile ExtensionMIME Type
VRML.wrl, .wrzmodel/vrml
Classic VRML.x3dv, .x3dvzmodel/x3d+vrml
XML.x3d, .x3dzmodel/x3d+xml
Binary.x3db, .x3dbzmodel/x3d+binary

The standard mechanism for indicating gzipped files is for the web server to set a special header field called »Content-Encoding«. This field indicates if the content has been encoding beyond that present in the media. This is the field that is used to indicate that the file has been compressed with gzip. When the web browser detects this field, it is responsible for gunzipping the file prior to passing it to the X3D browser.

If the file is gzipped, then the content-encoding value is »gzip« with the appropriate Classic VRML or X3D Binary extension. So gzip .x3dvz and gzip .x3dbz.

The simplest way to set your server to correctly display X3D files is to add the following to your document root's .htaccess file:

<IfModule mod_mime.c>
    AddType model/vrml .wrl
    AddType model/vrml .wrz
    AddType model/x3d+vrml .x3dv
    AddType model/x3d+vrml .x3dvz
    AddType model/x3d+xml .x3d
    AddType model/x3d+xml .x3dz
    AddType model/x3d+binary .x3db
    AddType model/x3d+binary .x3dbz
    AddEncoding gzip .wrz
    AddEncoding gzip .x3dvz
    AddEncoding gzip .x3dz
    AddEncoding gzip .x3dbz
</IfModule>