• Login/Register
  • Section: Internet Standard /Saturday 11th October 2014

    Alphabetic Index : A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

    Search β):

    * Data URI scheme *

    الگوی داده‌ای یوآرآی


    Iranian_Flag_Hand_Love_Heart.jpg
    (Wikipedia) - Data URI scheme

    The data URI scheme is a URI scheme (Uniform Resource Identifier scheme) that provides a way to include data in-line in web pages as if they were external resources. It is a form of file literal or here document. This technique allows normally separate elements such as images and style sheets to be fetched in a single HTTP request rather than multiple HTTP requests, which can be more efficient.

    Data URIs tends to be simpler than other inclusion methods, such as MIME with cid or mid URIs. Data URIs are sometimes called Uniform Resource Locators, although they do not actually locate anything remote. The data URI scheme is defined in RFC 2397 of the Internet Engineering Task Force (IETF).

    In browsers that fully support Data URIs for "navigation", JavaScript-generated content can be provided as file "download" to the user, simply by setting window.location.href to a Data URI. One example is the conversion of HTML tables to downloadable CSV using a Data URI like this: ''data:text/csv;charset=UTF-8,'' + encodeURIComponent(csv), where "csv" has been generated by JavaScript.

    The IETF published the data URI specification in 1998 as Proposed Standard on the IETF Standards Track, and hasn''t progressed it since. The HTML 4.01 specification refers to the data URI scheme, and data URIs have now been implemented in most browsers.

    Contents

    Web browser support

    As of March 2012, Data URIs are supported by the following web browsers:

    Email Client support

    Following clients support data URI for images

    Formatdata:,<data>

    The encoding is indicated by ;base64. If it is present the data is encoded as base64. Without it the data (as a sequence of octets) is represented using ASCII encoding for octets inside the range of safe URL characters and using the standard %xx hex encoding of URLs for octets outside that range. If <MIME-type> is omitted, it defaults to text/plain;charset=US-ASCII. (As a shorthand, the type can be omitted but the charset parameter supplied.)

    Some browsers (Chrome, Opera, Safari, Firefox) accept a non-standard ordering if both ;base64 and ;charset are supplied, while Internet Explorer requires that the charset''s specification must precede the base64 token.

    Advantages and disadvantages
    This section needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (January 2012)
    Advantages Disadvantages Examples HTML

    An HTML fragment embedding a picture of small red dot:

    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />

    As demonstrated above, data URIs encoded with base64 may contain whitespace for readability.

    CSS

    A CSS rule that includes a background image:

    ul.checklist li.complete { padding-left: 20px; background: white url(''data:image/png;base64,iVBORw0KGgoAA AANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0l EQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6 P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC'') no-repeat scroll left top; }

    In Mozilla Firefox 5, Google Chrome 17, and IE 9 (released June, 2011), encoded data must not contain newlines.

    JavaScript

    A JavaScript statement that opens an embedded subwindow, as for a footnote link:

    window.open(''data:text/html;charset=utf-8,'' + encodeURIComponent( // Escape for URL formatting ''<!DOCTYPE html>''+ ''<html lang="en">''+ ''<head><title>Embedded Window</title></head>''+ ''<body><h1>42</h1></body>''+ ''</html>'' ) );

    This example does not work with Internet Explorer 8 due to its security restrictions that prevent navigable file types from being used.

    Tags:Android, BlackBerry, Chromium, Data, Data URI scheme, Firefox, Google, Google Chrome, HTML, HTTP, Internet, Internet Engineering Task Force, Internet Explorer, Microsoft, Mozilla, Safari, US, Wikipedia, Yahoo


    Add definition or comments on Data URI scheme

    Your Name / Alias:
    E-mail:
    Definition / Comments
    neutral points of view
    Source / SEO Backlink:
    Anti-Spam Check
    Enter text above
    Upon approval, your definition will be listed under: Data URI scheme





    Happy Summer Sale

    Home About us / Contact    Products    Services    Iranian History Today    Top Iran Links    Iranian B2B Web Directory    Historical Glossary
    Copyright @ 2004-2016 fouman.com All Rights Iranian