tags:

views:

60

answers:

5

Hello,

I have a web service that returns a string of svg code. My problem is, I'm not sure what to do with it. I've never worked with SVG before. My questions are:

1) Is SVG have strong browser support? 2) How do I actually display the image that the SVG represents?

Thank you

A: 

SVG is supported by nearly all major browsers except IE i think but that also can be rendered with some plugin. IE renders VML

I suggest using RaphaelJS http://raphaeljs.com/reference.html#image

EDIT :

var r = Raphael("holder", 600, 540); //"holder" is the id of an empty div in html file 
r.image("lion.svg", 140, 140, 320, 240);// r.image(src,x,y,width,height)
jknair
Does Rapheal support loading SVG? I have some existing SVG XML but based on the documentation, I don't see how. Am I wrong?
i have edited the post with some basic code : you can check out the demos on raphael eg :http://raphaeljs.com/reflection.html here it loads a jpg u can replace the path with a svg . If you are comfortable with jquery try this http://keith-wood.name/svg.html
jknair
A: 

Starting with HTML5, you can embed SVG directly in a HTML document. This is supported by all of the major modern browsers, except Internet Explorer. You can use the HTML canvas concept (as illustrated here )

But, since you most likely can't leave IE folks behind yet, you can go with one of the three legacy options shown here

JamesMLV
A: 

Most state-of-the-art-browsers do support SVG, but few still used browsers (for example Internet Explorer 7) fail. So for perfect compatibility you should stick to gif, jpg or png formats. Test your own browser here: http://alphanemoon.com/2008/artikel/inline-svg-browser-test.xhtml

Simpzon
Internet Explorer 8 also lacks support for SVG.
colinmarc
+1  A: 

Svg is a specification for XML. Most modern browsers can just display it inline, but Internet Explorer can't.

I recommend wrapping all your svg content in svgweb, which is a thin layer around the svg code. If the user is using a standard compliant browser, it will display the svg normally. Otherwise, it converts it into flash content.

colinmarc
A: 

A good starting point is svgboilerplate.com.

Erik Dahlström