data-uri

Data URI file download in Interent Explorer

て烟熏妆下的殇ゞ 提交于 2019-12-02 00:09:13
问题 I have a web based application and was looking for a way for users to download their data from the websql tables. Someone suggested using data URI which seems to work in all browsers but Internet Explorer. The approach I am taking is to store all data in a variable and using text/csv MIME-Type and charset=UTF-8 character set encoding: document.location.href = 'data:text/csv;charset=UTF-8,' + encodeURIComponent(info); However when I click the link in internet explorer 9 it says the page can

Data URI file download in Interent Explorer

坚强是说给别人听的谎言 提交于 2019-12-01 23:15:57
I have a web based application and was looking for a way for users to download their data from the websql tables. Someone suggested using data URI which seems to work in all browsers but Internet Explorer. The approach I am taking is to store all data in a variable and using text/csv MIME-Type and charset=UTF-8 character set encoding: document.location.href = 'data:text/csv;charset=UTF-8,' + encodeURIComponent(info); However when I click the link in internet explorer 9 it says the page can not be displayed. Any ideas how to get this working in IE? Thanks. IE8 and IE9 only support the data URI

How to parse data-uri in python?

不想你离开。 提交于 2019-12-01 19:21:41
HTML image elements have this simplified format: <img src='something'> That something can be data-uri , for example: data:image/png;base64,iVBORw0KGg... Is there a standard way of parsing this with python, so that I get content_type and base64 data separated, or should I create my own parser for this? JRodDynamite Split the data URI on the comma to get the base64 encoded data without the header. Call base64.b64decode to decode that to bytes. Last, write the bytes to a file. from base64 import b64decode data_uri = "data:image/png;base64,iVBORw0KGg..." header, encoded = data_uri.split(",", 1)

Preserving newline characters in data:text URI

扶醉桌前 提交于 2019-12-01 09:20:43
I have a button in my extension that triggers the following code: chrome.tabs.create({url: 'data:text;base64,'+btoa(data), active:false}); This triggers a download of my string (data), as I expected. Unfortunately, it seems to be stripping out newline characters. I have tried other encoding methods, including utf-8 and the encodeUri() function. I also tried switching the mimetype to data:text/plain , but that simply opens in a new tab (with the correct newline characters) instead of downloading. Is there a way to encode my text so that newline characters are preserved? If not, is there a

Preserving newline characters in data:text URI

爷,独闯天下 提交于 2019-12-01 05:43:32
问题 I have a button in my extension that triggers the following code: chrome.tabs.create({url: 'data:text;base64,'+btoa(data), active:false}); This triggers a download of my string (data), as I expected. Unfortunately, it seems to be stripping out newline characters. I have tried other encoding methods, including utf-8 and the encodeUri() function. I also tried switching the mimetype to data:text/plain , but that simply opens in a new tab (with the correct newline characters) instead of

Data URI - how to create them in Java?

耗尽温柔 提交于 2019-12-01 03:09:00
I have just been told to send the thumbnail of an image using data URI. I have been searching it but all I found was that its basically a textual representation of a file and can be directly used in HTML. I could not really find how to make a data URI in Java. I have an input stream of a file. Can someone please shed some light on it and point me to a way to generate this? E.G. for an image: ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ImageIO.write(image, "png", baos); } catch (IOException e) { e.printStackTrace(); } String imageString = "data:image/png;base64," +

How to use a data uri with @font-face in Firefox

こ雲淡風輕ζ 提交于 2019-11-30 22:13:31
I am designing a splash page for a public wifi access point and Firefox refuse to display my custom font, while it work in every other browser (well, not IE < 9 but that was expected). The page need to work in the following constraint : No access to the Internet : This page is displayed before the user accept the term and condition, so everything is blocked The page is stored on the access point : That mean an embedded server probably written in C, and I can't really add additional header or something. Well its open source so it may be possible, but I am most certainly not an embedded

How to use a data uri with @font-face in Firefox

时光怂恿深爱的人放手 提交于 2019-11-30 17:55:02
问题 I am designing a splash page for a public wifi access point and Firefox refuse to display my custom font, while it work in every other browser (well, not IE < 9 but that was expected). The page need to work in the following constraint : No access to the Internet : This page is displayed before the user accept the term and condition, so everything is blocked The page is stored on the access point : That mean an embedded server probably written in C, and I can't really add additional header or

Compressing base64 data uri images

萝らか妹 提交于 2019-11-30 11:03:50
问题 Problem I'm creating multiple charts that are then sent to the server to create a PDF. This data can get large. Question What is the best way to compress and send the image data to the server Background The charts I'm creating are fairly complex, to save myself the headache all of this is converted to a canvas where the base64 data uri is generated. Currently the data uri(s) are posted to the server to handle the processing. Posted info can get fairly large at around 400-600kb each for a

Data URI link <a href=\"data: doesn't work in Microsoft Edge

心不动则不痛 提交于 2019-11-30 11:03:17
This simple code works perfectly everywhere except Microsoft Edge: <a href="data:text/plain;charset=utf-8,Test">link</a> [JSFiddle] In Microsoft Edge I'm getting "That's odd...Microsoft can't find this page" error: Examples from Mozilla documentation also do not working with the same result. Here's the output from Edge console: This error occurs when opening a new edge window, on new tabs it inputs data:text/plain;charset=utf-8,Test as search query into the default search engine. It seems like Microsoft Edge has no definition for data: Does anyone know a solution to this? Update: unfortunately