You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



About data: URLs and the mozilla implementation

Abstract:
This document discusses various questions, issues, bugs about Mozilla's data: URL parsing and protocol implementation.
This document is not an FAQ, but should address many non-testing questions about Mozilla's data: handling.

Audience:
Networking protocol and standards software testsers.
Mozilla users and content creators working with data: URLs
Engineers looking for background information on data: URLs and the testing methodology.

Overview:
data: URLs are defined by RFC 2397, and are described as:
   Some applications that use URLs also have a need to embed (small)
media type data directly inline. This document defines a new URL
scheme that would work like 'immediate addressing'. The URLs are of
the form:

data:[<mediatype>][;base64],<data>
The URLs allow content creators to embed small files inline HTML documents, without complicated, document level formating, like using MIME and cid: or mid:

Design summary:
  • preferences: none
  • UI: none
  • errors: none
  • proxy: none
  • dependencies: URL parsing, base64 decoding
  • consumers: File Handling, Layout
Common problems:
  • Syntax
    The format is very simple, but it is easy to forget to put a comma before the <data> segment or incorrectly base64 encode a file. How to use uuencode was described in a bug. Ian Hixie has a form so you can "build your own data: URL".

  • Formating in HTML
    A data: URL provides a file-in-a-file, which potentially can be very long relative to the width of a document. As a URL, the data: should be formattable with whitespace (LF, TAB, spaces), but there are practical issues with how that relates to base64 encoding.

  • Length limitations
    data: URLs in Mozilla are essentially unlimited in length. However browsers are not required to support unlimited length data: URLs as shown by the following document: Environment provided by the document.
    For example, data: URLs in Opera are limited to around 4100 characters.
  • Lack of error handling
    Invalid parameters, in media or typos when specifying "base64" are ignored, but no error is provided.
Testing requirements:
data: should be tested by security QA and internationalization.

Other browsers:

The data: protocol is supported by Opera v7.20 and above.
However, data: URLs are not supported by IE or Safari. If you have time to try out other browsers, please send us the results.

References:
RFC 2397 - The "data" URL scheme
Technical review of RFC 2397