Search code examples
javascriptdata-uri

What parameters are possible in a data uri's mediatype?


The "data" URL scheme suggests a data uri can include optional parameters in the mediatype:

   dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
   mediatype  := [ type "/" subtype ] *( ";" parameter )
   data       := *urlchar
   parameter  := attribute "=" value

The MSDN data uri page also mentions them. The MDN data uri page does not.

Other than charset, what parameters are possible in a data uri's mediatype?


Solution

  • Data URI's are similar to the content-type header. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7. You can put any parameter you like in there, but most browsers probably only support charset.