Closed yisibl closed 8 months ago
Thanks for the suggestion. I think the way I use it now as a progressive enhancement should work:
if (
('supports' in ClipboardItem &&
ClipboardItem.supports('image/svg+xml')) ||
!IS_SAFARI
) { /* … */ }
Once browser support is better, the UA sniffing part can go, too.
I see that currently using userAgent for detection, it would be more ergonomic to use
ClipboardItem.supports
. Currently, only Chrome supports this API.https://github.com/tomayac/SVGcode/blob/8371a65aef90b333980baabc425ff02aee32cac0/src/js/clipboard.js#L72-L86
It can be adjusted to:
My Microsoft partners @snianu and I recently fixed this API's support for
image/svg+xml
, which has been merged into Chrome 123.0.6298.0.However, I'm not sure if SVGcode can abandon older versions of Chrome.