svg-crowbar icon indicating copy to clipboard operation
svg-crowbar copied to clipboard

it works in firefox

Open graphicore opened this issue 10 years ago • 1 comments

I used svg-crowbar with a Firefox version 30.0 (Lubuntu) and it worked with my example. But the project page says "It only works in Chrome."

graphicore avatar Jul 08 '14 00:07 graphicore

My understanding is that the script is not guaranteed to work properly in FF. In particular I have experienced problems in two scenarios (but there could be more pitfalls): while reading cssrules from external stylesheets and when more then one svg block are embedded in one page. So if neither of the two conditions are present, i.e. one single svg block with inline style, it may execute and save to .svg without a glitch in Firefox.

In fact this seems the case for many d3js scripts and examples and snippets available from http://bl.ocks.org. Any confirmation of this?

The first problem I mentioned above can instead be observed in various Leaflet examples where svg creation is involved; trying to save the image trigger an error from FF: http://leafletjs.com/examples/geojson.html.

svg-crowbar.js Line: 224 If (ss.cssRules) { "SecurityError: The operation is insecure.".

However wrapping a try {} catch {} around some check code as suggested in this thread http://stackoverflow.com/questions/21642277/security-error-the-operation-is-insecure-in-firefox-document-stylesheets seems to be a viable solution.

balubino avatar Dec 03 '14 03:12 balubino