parse-data-url
parse-data-url copied to clipboard
Browser support
Would it be possible to add UMD or whatever thing is needed for just using it in browser? This would be really helpful for protoyping.
@strarsis Please test this version: https://github.com/killmenot/parse-data-url/tree/browser-support and let me know how it works
@strarsis does it work as planned? Have you had a chance to test it?
Thanks for the follow up. I tried it standalone in a codepen, but the function cannot be found, see this pen: https://codepen.io/strarsis/pen/yLYpJRM
@strarsis parseDataUrl requires valid-data-url to work correctly. See here. If it's not defined it throws an error
However, even if I include valid-data-url in your pen still doesn't work as expected:
https://codepen.io/killmenot/pen/eYprmbG
There are 2 problems:
datasection must be URL encoded- parameters in media type should be correct per https://tools.ietf.org/html/rfc2397#section-3 . So instead of
image/svg+xml;utf8, it should beimage/svg+xml;charset=utf8or image/svg+xml`
See another pen: https://codepen.io/killmenot/pen/MWarXYz
@killmenot: In the console, I can view an Object now.
The data attribute contains the data, but it is still encoded.
Can this library also decode the data, depending on what encoding/escaping was used.