data-url

How to encode image data within an HTML file?

十年热恋 提交于 2019-11-29 04:29:23
I'd like to be able to output an HTML file which includes an image (within the file itself). By Googling, I've come across a couple of ways to do this: javascript:imageData a data URI such as <IMG SRC="data:image/gif;base64,[...]"> <object ... > tag (although this uses a data URI, so may inherit the same limitations) But I don't know which is better supported by browsers, or if there are other alternatives. Can anyone with some practical experience of this offer me advice? Thanks. In regards to browser support, from Wikipedia : Data URIs are currently supported by the following web browsers:

Base64 PDF in new tab shows Blank Page before Refresh

家住魔仙堡 提交于 2019-11-28 10:54:34
The title says it all really... I have a base64 pdf string which I append to: data:application/pdf;base64, The pdf is brought into a new tab using a link in my webpage. A blank page will initially show up, but then I refresh the page and it displays perfectly. This issue only began once I changed my NodeJS code for retreiving the PDF, before it was retreiving the PDF with the https module but now I am using request . https://jsfiddle.net/o7upp4d8/ There is a current push to disallow new window s to have the ability to navigate to a data URL Intent to Deprecate and Remove: Top-frame navigations

How to encode image data within an HTML file?

时光毁灭记忆、已成空白 提交于 2019-11-27 18:26:39
问题 I'd like to be able to output an HTML file which includes an image (within the file itself). By Googling, I've come across a couple of ways to do this: javascript:imageData a data URI such as <IMG SRC="data:image/gif;base64,[...]"> <object ... > tag (although this uses a data URI, so may inherit the same limitations) But I don't know which is better supported by browsers, or if there are other alternatives. Can anyone with some practical experience of this offer me advice? Thanks. 回答1: In

Force download of 'data:text/plain' URL

此生再无相见时 提交于 2019-11-27 15:06:16
I was wondering whether it is possible to force a browser (at least Chrome) to download a data:text/plain URL. Chrome does download binary URLs (e.g. data:application/zip;base64,... ), but it does not download files that can be viewed inside the browser (such as text files). What I already tried with no luck so far is this: data:text/plain;content-disposition=attachment;filename=test.txt;... But it seems like I cannot add headers like this. Is there any way to make Chrome download a data:text/plain,... URL? As of now, it has been made possible to use <a download> in Chrome. Using dispatchEvent

Loading image src using a variable containing base64 data in AngularJS

旧巷老猫 提交于 2019-11-27 14:57:07
Loading image using variable containing base64 data in AngularJS I am trying to find the right way to load a image source from a variable containing base64 encoded image data (for example pulled from a canvas using toDataURL(); ). At first I just tried it like this: <img src="{{image.dataURL}}" /> where the image is a scope variable with a variable dataURL containing the base64 data. This is actually working pretty well, the only problem is that I get a 404 error in my console. Something like this: GET http://www.example.com/%7B%7Bimage.dataURL%7D%7D 404 (Not Found) Not so pretty. When I tried

generating MIDI in javascript [closed]

江枫思渺然 提交于 2019-11-27 14:19:33
问题 I'd like to generate a sequence of MIDI notes in javascript and then play it. Many plugins support MIDI, but I'm not aware of any supporting "data:" URL. Generating MIDI content is not a big deal - but feeding this content into player is. Anyone knows how this can be done - if not in general, then at least for specific plugin like QuickTime? 回答1: Very neat problem. I've been working a lot lately with base64-encoded images and have regularly been using http://www.greywyvern.com/code/php

Is it possible to use data URIs in video and audio tags?

♀尐吖头ヾ 提交于 2019-11-27 04:02:35
Assuming the following: The browser in question doesn't limit the size of data URIs. There is actually a purpose to doing this (so please refrain from asking "what's the point?" and "you do realize base64 encoding will expand your file by 33%, right?"). Is it technically possible to encode an entire video or audio file into base64, and embed it in an HTML document using either <audio> or <video>? SLaks It should be possible, except in IE8 and below, which does not support Audio/Video elements. Note that Opera does limit the size of the URI. These are my test results. I'll try with Ogg as well

Base64 PDF in new tab shows Blank Page before Refresh

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 03:53:53
问题 The title says it all really... I have a base64 pdf string which I append to: data:application/pdf;base64, The pdf is brought into a new tab using a link in my webpage. A blank page will initially show up, but then I refresh the page and it displays perfectly. This issue only began once I changed my NodeJS code for retreiving the PDF, before it was retreiving the PDF with the https module but now I am using request . https://jsfiddle.net/o7upp4d8/ 回答1: There is a current push to disallow new

Force download of 'data:text/plain' URL

左心房为你撑大大i 提交于 2019-11-26 17:00:42
问题 I was wondering whether it is possible to force a browser (at least Chrome) to download a data:text/plain URL. Chrome does download binary URLs (e.g. data:application/zip;base64,... ), but it does not download files that can be viewed inside the browser (such as text files). What I already tried with no luck so far is this: data:text/plain;content-disposition=attachment;filename=test.txt;... But it seems like I cannot add headers like this. Is there any way to make Chrome download a data:text

Loading image src using a variable containing base64 data in AngularJS

一世执手 提交于 2019-11-26 16:59:50
问题 Loading image using variable containing base64 data in AngularJS I am trying to find the right way to load a image source from a variable containing base64 encoded image data (for example pulled from a canvas using toDataURL(); ). At first I just tried it like this: <img src="{{image.dataURL}}" /> where the image is a scope variable with a variable dataURL containing the base64 data. This is actually working pretty well, the only problem is that I get a 404 error in my console. Something like