I'm creating an application that would preferably use canvas, however I need to support IE8.
I know I can use SVG but I was wondering if I could put the SVG element inside the canvas, but I don't want to load it twice, if you get me
I'm creating an application that would preferably use canvas, however I need to support IE8.
I know I can use SVG but I was wondering if I could put the SVG element inside the canvas, but I don't want to load it twice, if you get me
I would suggest you to look into canvg.
https://code.google.com/p/canvg/
canvg is a SVG parser and renderer. It takes a URL to a SVG file or the text of an SVG file, parses it in JavaScript, and renders the result on a Canvas element.
Example code:
var ctx = document.getElementById('test').getContext('2d');
ctx.drawSvg('<svg><rect x="0" y="0" width="100" height="100" fill="red" /></svg>', 0 , 0 , 500, 500);