Data URI power

Data URI schema provides a way to include data in-line in a web page (wikipedia). More importantly, it allows the data to come from a stream of bytes generated in your own browser and not the server. This post talks about usages of Data URI with a fun example with a URL shortener, about how we use Data URI in norbt.com, and finally about IE limitations and how we attempt to mitigate them in norbt.com.

What does it look like?

This is how the data URI for our logo will look like:

data:image/png;base64,iVBORw0KGgoAA .... 5ErkJggg==

The (….) is missing base64 data representing the image.
This is the image embedded as Data URI:

You could do view source code for this page to view the whole data URI for our logo.

Hacking with Data URI schema

Lots of interesting things can be done with Data URI schema. The main purpose on the net seems to be to limit the amount of hits required to load a page by embedding the images inside your html or css with data URIs.

There are other interesting usages which you can easily try.

Image in URL shortener

You can send an image via a URL shortener. You just give your data URI for your image to the URL shortener service instead of a URL. For example, if you had a tinyURL pointing to a Data URI instead of a URL, the link would go directly to the image (a Data URI with the image).

Example: http://tinyurl.com/y9auh64 (this may not work properly in some browsers, tested in FF3.6 and Opera10. In Chrome you may have to resubmit the redirected URL by moving focus to URL and pressing enter. We have not tested with IE8).

You can store your images as text anywhere as Data URI. You can send emails with just the appropriate link to the image.

These are just some of the many uses of Data URI.

Norbt.com usage of Data URI

In norbt.com we use DataURI to provide a link to download files inside your norbt, and to provide a preview of the images inside your norbt.

By using DataURI that are generated in the browser, the decryption and display of the message happens in the browser without server intervention.

IE Limitations

As you may be able to guess, Internet Explorer 8 limits the size Data URIs to 32K.  Hopefully this limit will disappear with Internet Explorer 9.

We think that if it wasn’t due to the poor support of Internet Explorer for Data URI, they would be a lot more popular. It would probably make web pages more interesting as well, because more people would be inclined to use this capability.

If you or your users insist on using IE, we provide an applet that allows you to download the file from the browser, without server intervention. It works, but it adds an additional step that is not necessary in most modern browsers.

141 responses to “Data URI power”

  1. CODY

    dehli meats during pregnancy

    Buy_now it…

  2. JULIO

    hives rash from coming off prednisone

    Buy_generic drugs…

  3. ALFREDO

    mini insulin fridge

    Buy_generic drugs…

  4. WALTER
  5. ANDREW

    avelox treats for bacteria

    Buy_drugs without prescription…

  6. ALEX

    imodium during pregnancy

    Buy_generic meds…

  7. SERGIO

    drug treatment for bipolar disorder

    Buy_generic pills…

  8. WALLACE

    diabetes popcorn

    Buy_generic pills…

  9. DOUG

    allergy blood testing

    Buy_it now…

  10. MARION

    atlanta zyprexa lawyers

    Buy_generic drugs…

  11. BILL
  12. STEVE

    zocor and ms

    Buy_it now…

  13. ALEX
  14. NEIL

    abdominal pain lutenizing hormone

    Buy_generic drugs…

  15. SHAWN

    ic tramadol hcl 50 mg

    Buy_generic meds…

  16. KENT
  17. NATHAN

    hot dog hospital diet substitutions

    Buy_generic drugs…

  18. GUY

    resume clinical sas programmer

    Buy_generic meds…

  19. ROSS

    build muscle mass diet

    Buy_drugs without prescription…

  20. ALEJANDRO

    breast cancer awareness wristband

    Buy_generic meds…

  21. TODD

    healing lithium water in utah

    Buy_no prescription…

  22. WILLIAM
  23. LEE
  24. LUTHER

    free diabetes logbooks to print

    Buy_generic drugs…

  25. FREDDIE

    twin pregnancy obstetrician specialist dallas

    Buy_drugs without prescription…

  26. PATRICK

    psychotic depression and philadelphia

    Buy_generic meds…

  27. ARTURO
  28. LESLIE

    drug testing passing short notice

    Buy_generic meds…

  29. BOBBY

    overweight employee abuse

    Buy_generic drugs…

  30. DAVE

    hiv quality of life survey tools

    Buy_drugs without prescription…

  31. ENRIQUE

    liquid tylenol and dogs

    Buy_without prescription…

  32. TERRENCE

    menopause thyroid cancer

    Buy_without prescription…

  33. IVAN
  34. IAN
  35. JORGE

    breast cancer site is having trouble

    Buy_drugs without prescription…

  36. JIM

    boost metabolism foods

    Buy_now…

  37. REGINALD

    free fast diet tips

    Buy_generic meds…

  38. VICTOR
  39. GARY
  40. RAMON

    children@prozac.buy” rel=”nofollow”>…

    Buywithout prescription…

  41. nathaniel

    Download@alternative.Rock” rel=”nofollow”>.

    Search rock UK Charts…

Leave a Reply