I am facing a problem where my server app gets a JSON’s DataURI and I would like to parse it into a JSON again. How could I do this? I tried different things but nothings seems to work. I tried simply parsing it or encodeURI(data); but still I can’t get the original JSON. This is the Data URI: data:application/json;base64,ew0KICAgICJtYWx0X3R5cGUiOiAibG9nIiwNCiAgICAibWFsdF9kYXRhIjogIldvdywgdSByIGFsbW9zdCB0aGVyZSA6TyINCn0= I
Tag: data-uri
Image file size from data URI in JavaScript
I am not sure it’s even possible but – can I get the image file size from data URI? For example, let’s say there is an IMG element where src goes: Based on the src, can I get the image file size by using plain JavaScript? (without server request) Answer If you want file size, simply decode your base64 string
Content-Security-Policy (CSP): how to allow svg image in object
I am using the js plugin that adds inside itself SVG images. I have added CSP policy to my website, but I can’t configure it to allow plugin’s code. Its code looks like: I am looking for a configuration that allows SVG image that is rendered in the object. I am tried different options from there – CSP: object-src. But
Download data URL file
I’m playing with the idea of making a completely JavaScript-based zip/unzip utility that anyone can access from a browser. They can just drag their zip directly into the browser and it’ll let them download all the files within. They can also create new zip files by dragging individual files in. I know it’d be better to do it serverside, but