Is there any size limitation for data protocol URL "data" URL scheme
values? I'm interested in limitations in popular web browsers. In another words, how long data:image/jpg;base64,base64_encoded_data
can be in <img src="data:image/jpg;base64,base64_encoded_data" />
or background-image: url(data:image/jpg;base64,base64_encoded_data)
?
views:
555answers:
5It is really the "data URI scheme".
As per the Wikipedia page, IE7 lacks support, and IE8 betas limit it to 32kB of data.
From http://www.ietf.org/rfc/rfc2397.txt:
The "data:" URL scheme is only useful for short values. Note that some applications that use URLs may impose a length limit; for example, URLs embedded within
<A>
anchors in HTML have a length limit determined by the SGML declaration for HTML [RFC1866]. The LITLEN (1024) limits the number of characters which can appear in a single attribute value literal, the ATTSPLEN (2100) limits the sum of all lengths of all attribute value specifications which appear in a tag, and the TAGLEN (2100) limits the overall length of a tag.
Just an FYI, I was able to load a 130K image using a data url in Firefox 3.5 from a JavaScript ajax call. It truncated the image in IE 8, but the whole thing showed up in FF.