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

fabric.loadSVGFromURL gives No 'Access-Control-Allow-Origin' header is present on the requested resource. error #3791

Closed
niyotaa opened this issue Mar 20, 2017 · 3 comments

Comments

@niyotaa
Copy link

niyotaa commented Mar 20, 2017

Version

1.7.6

Test Case

http://jsfiddle.net/7gvJG/166/

Steps to reproduce

Run the fiddle

Expected Behavior

Both SVG and image should load on the canvas but only image loads not the SVG image.
Both the images are in the same S3 amazon bucket

Actual Behavior

i see others have the same issue but when they try to do a dataURL. i thought i'll create a new one.

Please let me know of any workaround to this issue if it exists.

Thanks,
Harsha

@niyotaa
Copy link
Author

niyotaa commented Mar 21, 2017

just to help anyone looking to find a workaround, This is the solution that worked for me
HTTP.get(SVGURL, {}, function (err, response) {

        if (!err) {
            var svg = new String(response.content)
            fabric.loadSVGFromString(svg, function (ob, op) {
                canvas.add(new fabric.PathGroup(ob, op).set({ left: 100, top: 100 }).scale(0.7));
            });
        }

    });

@niyotaa
Copy link
Author

niyotaa commented Mar 22, 2017

well, even this solution is not reliable.
I had to download the image on the server and pass it to the client. This is very slow but works all the time since the requests from my server to S3 has all the correct headers than request from client to S3.

I hope this feature gets implemented soon in fabricjs.

@asturur
Copy link
Member

asturur commented Mar 25, 2017

duplicate of #3589

@asturur asturur closed this as completed Mar 25, 2017
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