# Embed svg file in html

**URL:** <https://www.ruby-forum.com/t/embed-svg-file-in-html/180193>\
**Category:** Ruby\
**Created:** [December 14, 2009, 1:34pm UTC](https://www.ruby-forum.com/t/embed-svg-file-in-html/180193 "2009-12-14T13:34:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![duke-brahma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@duke-brahma](https://www.ruby-forum.com/u/duke-brahma)\
**Post date:** [December 14, 2009, 1:34pm UTC](https://www.ruby-forum.com/t/embed-svg-file-in-html/180193/1 "2009-12-14T13:34:48Z")

</div>

In my rails application view i am using a svg file.I have a  
static .svg file and then embed it in a html file.

## Level 2 GSmart Report

in controller i render the html file.

render :file =\>‘C:/instantrails/rails\_app/ALUgsm/app/views/alu\_gsm/  
report.html’

It is showing the html but not svg content.  
Can anybody help me,what to do?

---

<div class="post-metadata">

**Author:** ![duke-brahma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@duke-brahma](https://www.ruby-forum.com/u/duke-brahma)\
**Post date:** [December 14, 2009, 2:18pm UTC](https://www.ruby-forum.com/t/embed-svg-file-in-html/180193/2 "2009-12-14T14:18:52Z")

</div>

Your first action should be to google for “embed SVG HTML”.

After that, I suggest:

(1) Reproduce your problem using entirely static HTML files, which you  
access using URLs like file:///temp/whatever.html

This takes Rails out of the equation altogether, so you can ask your  
question on a HTML or web design mailing list if the embedding doesn’t  
work.

(2) If you can make it work with the static pages but not with Rails,  
you can ask the question again on a Rails mailing list. Post your  
relevant bits of server logs, so you can show whether the embed tag is  
attempting to fetch the svg, and if so, whether it’s succeeding or not.

Remember that you have a relative URL in your HTML, i.e.  
src=“report.svg”, so the browser will probably be fetching  
/some\_controller/report.svg. Is that what you were expecting, and is  
your application serving it?

(3) Rails happens to be written in Ruby. That’s is a long way from your  
problem area, so asking the question here on a Ruby programming language  
mailing list is inconsiderate at best.

For more advice, see  
[http://www.catb.org/~esr/faqs/smart-questions.html#intro](http://www.catb.org/~esr/faqs/smart-questions.html#intro)

---

<div class="post-metadata">

**Author:** ![duke-brahma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@duke-brahma](https://www.ruby-forum.com/u/duke-brahma)\
**Post date:** [December 14, 2009, 2:30pm UTC](https://www.ruby-forum.com/t/embed-svg-file-in-html/180193/3 "2009-12-14T14:30:24Z")

</div>

removed\_email\_address@domain.invalid schrieb:

> width=‘100%’ height=‘100%’ /\>  
> It is showing the html but not svg content.  
> Can anybody help me,what to do?

Congratulation!

The Jeszra documentation and Gestalitems use lots of svgs:  
See [Jeszra](http://jeszra.sourceforge.net/jeszra/index.html)  
[http://jeszra.sourceforge.net/pages/index.htm](http://jeszra.sourceforge.net/pages/index.htm)  
[http://gestaltitems.sourceforge.net](http://gestaltitems.sourceforge.net)

If you don’t see any svg, then your browser is the culprit.  
Camino 2.0 for example does not show html embedded svgs…  
bug in the browser.

If you see them:

-roger

---

<div class="post-metadata">

**Author:** ![duke-brahma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@duke-brahma](https://www.ruby-forum.com/u/duke-brahma)\
**Post date:** [December 14, 2009, 3:51pm UTC](https://www.ruby-forum.com/t/embed-svg-file-in-html/180193/4 "2009-12-14T15:51:45Z")

</div>

> It is showing the html but not svg content.  
> Can anybody help me,what to do?

Any issue related to browser?

iÃ±igo
