Data URI

We have already used on several occasions Data URI (Uniform resource identifier) throughout this book, but never got into details on what can we use it for as well as what are the limitations. Data URI are often referred to as Data URL (Uniform Resource Locator) though technically speaking they don't actually locate anything from a remote site.

In this example, we will use different media types and check the size constraints.

Getting ready

We will only need browser and some sample text files for this example. The files can be downloaded as part of the files folder in the example files.

How to do it...

In order to see some of the options available we will create a simple HTML file with few different use scenarios:

  1. The head section will include ...

Get HTML5 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.