Questions tagged [data-uri]

A data URI is a URL whose scheme part is 'data:' and which directly represents a resource, rather than the location of a resource.

The following is an example of a data URI:

data:text/html;base64,PCFkb2N0eXBlIGh0bWw+CjxodG1sPgogIDxoZWFkPg
ogICAgPG1ldGEgY2hhcnNldD11dGYtOD4KICAgIDx0aXRsZT5UaGVyZSBpcyBuby
BzcG9vbi48L3RpdGxlPgogICAgPHN0eWxlPgogICAgICBodG1sIHsgYmFja2dyb3
VuZDogI2ZhNTsgaGVpZ2h0OiAxMDAlIH0KICAgICAgcCB7IGNvbG9yOiAjNWFmOy
B0ZXh0LWFsaWduOiBjZW50ZXI7IG1hcmdpbjogNmVtOyBmb250LXNpemU6IDJlbS
B9CiAgICA8L3N0eWxlPgogIDwvaGVhZD4KICA8Ym9keT4KICAgIDxwPjxhIGhyZW
Y9aHR0cDovL3N0YWNrb3ZlcmZsb3cuY29tL3RhZ3MvZGF0YS11cmkvaW5mbz5CYW
NrPC9hPjwvcD4KICA8L2JvZHk+CjwvaHRtbD4K

That data URI contains a HTML document. If pasted into the address bar of a compliant browser, the document it contains will be displayed without the need to request any external resources.

Data URIs can be used in the href or src attributes of <a> and <img> elements, etc., eliminating the need for additional HTTP requests.

592 questions
0
votes
2 answers

Does data URL only accept binaries or base 64 for Powerpoint?

There is a trick for creating files in the client using data uri. For example, to create a MS powerpoint you can do something like
dublintech
  • 16,815
  • 29
  • 84
  • 115
0
votes
1 answer

Using data URIs to prompt the user to save files

I'm writing a web application which allows a user to select a PNG file, write an iTXt chunk to it and then save it back to their local file system. I would use the new FileWriter API to do so but currently only Google Chrome has added support for…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
0
votes
1 answer

Getting a data URI for cross-domain content?

For all intents and purposes, let's say I have a webpage with an input field where users can enter an image URL, click a button, and be given a data URI for the resource at the other end of their URL (e.g., the Google logo). Reading around, I…
rmanna
  • 1,133
  • 14
  • 14
0
votes
1 answer

preg_replace image src

I'm attempting to scan through my content and replace image source tags with something else (more notably, dataURIs when supported) - based on a couple of questions I've read through here, I'm trying preg_replace(): // Base64 Encodes an…
Zach
  • 1,185
  • 3
  • 24
  • 60
0
votes
1 answer

Is it possible to encode a file as a Data URI in Java?

I have the need to encode a file as a data URI in Java, is it possible for me to retrieve this in the following format? data:application/octet-stream;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA== I've been looking for something like it, but had no luck so…
eBergamo
  • 101
  • 3
  • 6
0
votes
1 answer

Data URI from Image Javascript

I want to create an Data URI from a local image by totally using javascript Can somebody javascript suggest a function to convert a local image. i used canvas to load image and convert to data uri function load() { var can =…
Divam Gupta
  • 228
  • 4
  • 6
0
votes
1 answer

Large amount of dataURIs compared to images

I'm trying to compare (for performance) the use of either dataURIs compared to a large number of images. What I've done is setup two tests: Regular Images (WPT) Base64 (WPT) Both pages are exactly the same, other than "how" these images/resources…
Zach
  • 1,185
  • 3
  • 24
  • 60
-1
votes
2 answers

Convert image from url into data uri in node.js

I have been looking for a JavaScript solution to converting an image from an external url to a data uri. I have installed multiple packages and tested multiple methods but have not been able to find a usable method for doing so. What I want: var…
WillDevv12
  • 33
  • 4
-1
votes
2 answers

How does one retrieve and collect base-64 data-urls from the files-property of a multiple file input type?

I am working on a front end project where I want to store only 2 images, previousImage and nextImage, and show them on a div called previousWeek and nextWeek respectively. I am using // retrieve file…
-1
votes
1 answer

Image to base64 JavaScript

So I'm trying to use the HTML canvas element to take an external image URL and convert it to Base64 so I can extract the colors from it. I'm getting back a base64 string but when I check the output it's blank. Here's my code: var c =…
moose
  • 21
  • 1
  • 4
-1
votes
1 answer

D3.js pulling and embedding DataURI images with Promises

I'm building a data visualization which relies on a lot of small raster images, delivered as AWS URLs via JSON API. This works fairly well, until I try to implement my next step, which is rendering the data visualization as a PNG to download. In…
bumcode
  • 362
  • 4
  • 13
-1
votes
1 answer

Making a downloadable file with the dataURL

I am trying to make a downloadable file from only a dataURL and I am not sure why it is not working. I am reading the dataURL from a file and inserting its dataURL into an with the download attribute. but when i generate de click the page goes…
Alejandro Peña
  • 131
  • 2
  • 10
-1
votes
1 answer

Flask not puting data url string into the template

I'm not a flask pro, but is there a limit to the size of a string being pasted into a template? My template looks sth like this: {% if taint is not none and url is not none %} [...] } update(d); }
reijin
  • 133
  • 10
-1
votes
1 answer

HTML integration of image URI for validation

I have a problem with validation of my site with, mainly because of data/images base64 URIs. Here is the diagnostic of https://html5.validator.nu/ Error: Malformed byte sequence: e9. At line 2, column 259 (etc.) As for https://validator.w3.org/ it…
jean
  • 1
  • 2
-1
votes
1 answer

Resource usage difference when web browser keeps webpage images with URLs or Data URIs

One can source images on a webpage with usual urls: or, with data uris: // data:[][;base64], That is similar to having a script inside the HTML document or having a script…
sçuçu
  • 2,960
  • 2
  • 33
  • 60
1 2 3
39
40