exupero / saveSvgAsPng

Save SVGs as PNGs from the browser.
MIT License
1.09k stars 362 forks source link

not working in Safari 10.0.1 #125

Closed ziinfo closed 7 years ago

ziinfo commented 7 years ago

saveSvgAsPng is not working in Safari 10.0.1 I have tested it on: Safari version 10.0.1 - not working Safari version 9.1.2 - works

https://jsfiddle.net/ziinfo/qj56axqk/

amergin commented 7 years ago

I'm seeing this problem too. I've been using the same conversion method as saveSvgAsPng does in my code, and it has been working in the past in Safari, but not properly in the newest version.

exupero commented 7 years ago

Can you be more specific about what's not working? Does the download fail? Are there any errors in the developer console? Does the test page show any images?

amergin commented 7 years ago

@exupero: In the jsfiddle above, the download is not triggered. Only one error in console ("Error while parsing the 'sandbox' attribute: 'allow-modals' is an invalid sandbox flag.") but it's presumably related to the Jsfiddle sandbox.

Test page: With linked SVG image -> Preview is empty At a higher resolution -> In preview pixelated rectangle is missing With foreign objects -> Preview empty When setting xmlns on foreign object children -> Preview empty With custom fonts -> Preview empty

Console: image

massone commented 7 years ago

@amergin: I don't think it's Jsfiddle related, you don't get this error in Chrome and it works in Safari 9 despite the error

massone commented 7 years ago

@exupero: Safari 10 renders images correctly, however I get error: Rendered SVG images cannot be downloaded in this browser.

exupero commented 7 years ago

Sounds like Safari 10 throws a SecurityError like IE. You'll likely need to use canvg to work around it. See the Support section of the Readme.

ziinfo commented 7 years ago

Just spotted: With foreign objects -> Preview empty When setting xmlns on foreign object children -> Preview empty

the rest renders fine

Jephuff commented 7 years ago

If you turn off the popup blocker, it should open the png. unfortunately it doesn't seem that safari supports the download attribute on anchor tags, not sure if there is a fix for that.