Ok, so I know how to place a static SVG into html:
<object data="your.svg" type="image/svg+xml">
<img src="yourfallback.jpg" />
</object>
But, how do I place the actual SVG document (eliminating the link to save an http request):
<object data='<path d="m315.9,581.1c.....1,22.8z" fill="#fff" stroke="#4ea3ff" stroke-miterlimit="10" stroke-width="36"></path>' type="image/svg+xml">
<img src="yourfallback.jpg" />
</object>
I can't seem to get it to work.
asked Feb 18, 2013 at 20:08
Justin Elkow
2,9638 gold badges34 silver badges63 bronze badges
2 Answers 2
You can make a data URI of the svg if you want to keep using the object tag, see this answer for the details.
answered Feb 19, 2013 at 12:19
Erik Dahlström
61.3k12 gold badges123 silver badges140 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Justin Elkow
Thanks, I will use the dataURI
Just paste in the svg. But you'll need to start it with an <svg> tag though, you can't just use a raw <path>
<!DOCTYPE html>
<html>
<body>
<svg height="190">
<polygon points="100,10 40,180 190,60 10,60 160,180"
style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;">
</svg>
</body>
</html>
answered Feb 18, 2013 at 21:03
Robert Longson
125k27 gold badges272 silver badges258 bronze badges
3 Comments
Justin Elkow
Robert Longson
You think that users of Opera mini will form a large part of the viewers of your site?
Justin Elkow
Older versions of Safari and iOS too...together its enough to prefer the dataURI
lang-html