What is MIME type "application/x-webarchive"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

The MIME type application/x-webarchive stores an entire web page in one file. It bundles HTML, images, styles, and scripts together so the page can be viewed offline.

It is mainly used to save web content in a single package. This ensures that the visual layout and functionality remain intact even when the page is not online.


The format is notably used by Apple's WEBARCHIVE files. It is also applied with WAR files, particularly by Konqueror for website archives.

For further details, refer to external sources such as Wikipedia.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: application/x-webarchive    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="application/x-webarchive">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'application/x-webarchive');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the primary use of application/x-webarchive?

This MIME type is used to bundle a complete webpage, including HTML, images, CSS, and scripts, into a single binary file. It is most commonly associated with Apple Safari on macOS and iOS for saving pages for offline viewing, similar to the MHTML format used by other browsers.

Is a .war file with this MIME type the same as a Java Web Archive?

No, this is a common confusion. While the Konqueror browser uses the .war extension for web archives with the MIME type application/x-webarchive, Java Web Archives use the MIME type application/java-archive (or application/zip). Always verify the file header or origin before attempting to deploy it.

How do I open a .webarchive file on Windows or Android?

Most non-Apple browsers (Chrome, Firefox, Edge) do not natively support this format. To view these files on Windows or Android, you often need to use a dedicated third-party viewer, an online converter tool to change it to PDF or HTML, or a text editor capable of reading binary property lists (plists).

How do I configure Apache to serve .webarchive files correctly?

To ensure your Apache server sends the correct headers, add the following line to your .htaccess file or main configuration: AddType application/x-webarchive .webarchive. This helps client browsers understand that the file is a bundled web archive rather than a generic binary stream.

Why does my browser download the file instead of displaying it?

If the server sends the file as application/octet-stream or if the browser (like Chrome or Firefox) does not have a plugin to render application/x-webarchive, it will default to downloading the file. Safari is one of the few browsers that will attempt to render this content directly.

Can I convert application/x-webarchive to standard HTML?

Yes, but because the format is essentially a binary property list (plist), you cannot simply rename the extension. You must use Safari's "Save As" feature to export it as "Web Page Source" or use command-line tools like plutil on macOS to convert the binary data into readable XML or extract the resources.

Are there security risks associated with opening these files?

Yes, because application/x-webarchive files contain executable JavaScript and other active content. Opening a malicious archive from an untrusted source can trigger cross-site scripting (XSS) attacks or run scripts in your local context. Treat them with the same caution as application/zip files.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.