v146 · Web APIs · Data URLs
Data URL MIME Type Parameter Preservation
Chrome 146 preserves MIME type parameters in Data URLs. A URL like data:text/html;charset=utf-8;base64,… previously had its charset=utf-8 parameter stripped before the resource was served. Chrome 146 keeps the full MIME type — matching the spec and aligning with Firefox and Safari.
concepts
-
Charset Parameter Demo
Create Data URLs with and without
charsetparameters, load them in iframes, and verify that the charset is preserved and honoured by the browser when rendering the content. -
MIME Type Explorer
Inspect the full MIME type (including parameters) that the browser assigns to a fetched Data URL. Compares how Chrome 146 reports the content-type versus what older versions stripped.
-
Roundtrip tester
Build a data URL with arbitrary MIME parameters, fetch it, and read the resulting
Blob.typeback. The verdict box reports PASS / PARTIAL / FAIL so the page doubles as a conformance check. -
Binary Data URL Builder
Drop any file to read it via
FileReaderand extract its MIME parameters. A parameters table shows which are preserved in Chrome 146 vs stripped pre-v146, with a before/after toggle and live truncated data URL display. Three presets (PDF, CSV, JPEG with parameters) plus a render test grid across<img>,<a download>, and<iframe>verify real browser behaviour.
why it shipped
The Data URL spec (Fetch) requires the MIME type and all its parameters to be forwarded when a data URL is fetched. The charset parameter is particularly important: it tells the browser how to decode the body. When Chrome stripped it, a UTF-16 or ISO-8859-1 encoded body was silently re-decoded as UTF-8, corrupting non-ASCII content. Chrome 146 stops stripping parameters, completing alignment with the spec and other browsers.
structure of a Data URL
data:[<mediatype>][;base64],<data>
// mediatype = mime-type [ ";" parameter ]*
// parameter = attribute "=" value (e.g. charset=utf-8)
// Examples:
data:text/plain,Hello // plain text, default charset
data:text/plain;charset=utf-8,Héllo // charset preserved in Chrome 146
data:text/html;charset=utf-8,<h1>Hi</h1> // HTML with charset
data:text/html;charset=utf-8;base64,PGgxPkhpPC9oMT4= // base64-encoded
// Before Chrome 146: charset parameter was stripped
// After Chrome 146: charset=utf-8 is preserved in the served MIME type