0

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

2 Answers 2

1

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
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I will use the dataURI
0

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

3 Comments

But, that's less supported than SVG as an object link vs link. Also, with the <object> tag, I get a PNG fallback for free, right?
You think that users of Opera mini will form a large part of the viewers of your site?
Older versions of Safari and iOS too...together its enough to prefer the dataURI

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.