I have a web application using SVG for a drawing canvas. Drawing scribbles and writing text works. Now I want to be able to add bitmap images to the canvas. This does not work at all.
I am trying to add an image to the SVG via the <image>
tag. If I write static HTML that works like you would expect. However, I am creating only the SVG document in HTML code, all other elements are created dynamically via JavaScript. While this works for paths and text elements, it does not seem to work for images. I would like to know, why.
I created a JSFiddle to demonstrate the problem: http://jsfiddle.net/cc4PH/1/. As you can see in the developer tools, the code is the same in the static case and the dynamic case. But only in the static case the image is displayed. This is no browser-specific problem. I could reproduce it with Chrome, Firefox, Safari and Opera.
Do I have to somehow tell SVG to load the image?
Thanks in advance!