IE11 SCRIPT5022: SecurityError after diagram.makeImageData()

Hi

I’m trying to figure out (without success) how to convert diagram with SVG to png in IE11

<script type="text/javascript">
    var myDiagram;
    (function init() {
        var $ = go.GraphObject.make;  

        myDiagram = $(go.Diagram, "myDiagram",  { initialContentAlignment: go.Spot.Center });
        myDiagram.nodeTemplate =
          $(go.Node, "Auto", 
                $(go.Shape, "Circle", { fill: "blue", strokeWidth: 2, width: 80, height: 80 }),
                $(go.Picture, { desiredSize: new go.Size(26, 26), scale: 1.53, source: "/content/svg/finish/finish.svg" })
          );

        myDiagram.model = new go.GraphLinksModel(
        [
          { key: "Alpha" }
        ]);
    })();
</script>

It works fine in every other browser but in IE11 i got SCRIPT5022: SecurityError.

Svg can be found here
finish.svg

When I tried your actual script, I noticed that the init function is being executed before the page is loaded. If you delay calling init() until after page load, it works fine in IE.

Hi Walter

I’ve created a simple asp mvc project for you. After you run it click on “makeImageData()” button. IE11 supposed to throw an exception at this point.

asp mvc project

Ah, sorry about that. I did not realize that it was the call to Diagram.makeImageData that was the problem, even though it’s in the title of this topic. (But my caution about when to create a Diagram and initialize its Model still applies.)

We’ll investigate this.

Thanks for reporting this. This is a bug in 1.5.1 and will be fixed in the next release.

Once its fixed, the output will be consistent across all browsers, which will mean that the SVG simply won’t show when there are cross-origin security errors. I hope that matches your expectation.

@RassaR, GoJS 1.5.2 has been released and should fix this issue.

http://gojs.net/latest/index.html

Hi Simon

I just updated gojs to 1.5.2 and i’m afraid output is not consistent across all browsers. I haven’t notice exceptions in IE11 but svg don’t show up in output.

Everything is on same domain. I even added “Access-Control-Allow-Origin *” header but it didn’t help at all.

My goal is to generate png in IE11 that look the same or is very similar to png generated by other browsers.