Fabric js: SVG cannot import from url

I am working with fabric js , & i am getting problem in importing SVG from url on local system

fabric.loadSVGFromURL('svg/1.svg', function(objects, options) {
  var obj = fabric.util.groupSVGElements(objects, options);
  canvas.add(obj).renderAll();
});

& try also

var site_url =  'svg/1.svg';
fabric.loadSVGFromURL(site_url, function(objects) { 
          var group = new fabric.PathGroup(objects, { 
          left: 165, 
          top: 100, 
          width: 295, 
          height: 211 
        }); 
        canvas.add(group); 
        canvas.renderAll(); 
          });

& getting error in console for both codes

enter image description here

but if i use online url like

http://fabricjs.com/assets/1.svg

then svg is imported, but i need it to import from local.

can anyone help to resolve this
Thanks in advane


Source: javascript

Leave a Reply