views:

555

answers:

5

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)?

A: 

It is really the "data URI scheme".

As per the Wikipedia page, IE7 lacks support, and IE8 betas limit it to 32kB of data.

Jay Kominek
+1  A: 

Regarding limitations in web browsers, MSIE 6/7 do not support the data url scheme... More info on wikipedia

The length limits are different per browser - i believe IE8 allows up to 32KB and opera is 4KB, but can't really tell about other browsers...

jcinacio
+2  A: 

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.

John Saunders
Looks like "data" useless within classic HTML. However, XHTML and CSS may have different restrictions
LicenseQ
You would want to locate the schema for XHTML and the specification for CSS and find out.
John Saunders
A: 

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.

Brad Broerman
A: 

Seems the limit in Firefox 3.6 is 600KB.

Riatre