Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser support #7

Open
strarsis opened this issue Apr 20, 2020 · 5 comments
Open

Browser support #7

strarsis opened this issue Apr 20, 2020 · 5 comments

Comments

@strarsis
Copy link

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.

killmenot added a commit that referenced this issue Apr 20, 2020
@killmenot
Copy link
Owner

@strarsis Please test this version: https://github.com/killmenot/parse-data-url/tree/browser-support and let me know how it works

@killmenot
Copy link
Owner

@strarsis does it work as planned? Have you had a chance to test it?

@strarsis
Copy link
Author

strarsis commented May 4, 2020

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

@killmenot
Copy link
Owner

@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:

  1. data section must be URL encoded
  2. 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 be image/svg+xml;charset=utf8 or image/svg+xml`

See another pen: https://codepen.io/killmenot/pen/MWarXYz

@strarsis
Copy link
Author

strarsis commented May 9, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants