FAQ
In the handler below WindSpeedDial() returns the svg to draw an image.

*func handler(w http.ResponseWriter, r *http.Request) { *
* db.OpenDatabase()*
* fmt.Fprintf(w,svgo1.WindSpeedDial() )*
*}*

It works fine when called as page in its own right with e.g.
*http://www.example.com/svgPage.fgci*

However, when called from another page as the *src* for an image like this:

* <img id="windspeed" src="http://www.example.com/svgPage.fgci" alt="wind
speed" style="width: 100%"> *

nothing happens at all. Just no output. No mention in apache error log

Any ideas?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Frits van Bommel at Dec 6, 2015 at 7:51 pm
    Did you try adding a Content-Type header?

         w.Header().Set("Content-Type","application/svg+xml")
    On Sunday, December 6, 2015 at 7:47:22 PM UTC+1, Peter Wilkinson wrote:

    In the handler below WindSpeedDial() returns the svg to draw an image.

    *func handler(w http.ResponseWriter, r *http.Request) { *
    * db.OpenDatabase()*
    * fmt.Fprintf(w,svgo1.WindSpeedDial() )*
    *}*

    It works fine when called as page in its own right with e.g. *http://www.example.com/svgPage.fgci
    <http://www.example.com/svgPage.fgci>*

    However, when called from another page as the *src* for an image like
    this:

    * <img id="windspeed" src="http://www.example.com/svgPage.fgci
    <http://www.example.com/svgPage.fgci>" alt="wind speed" style="width:
    100%"> *

    nothing happens at all. Just no output. No mention in apache error log

    Any ideas?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Peter Wilkinson at Dec 7, 2015 at 8:42 am
    Yup, that was it. Thanks!
    Peter

    On Sunday, December 6, 2015 at 7:50:55 PM UTC, Frits van Bommel wrote:

    Did you try adding a Content-Type header?

    w.Header().Set("Content-Type","application/svg+xml")
    On Sunday, December 6, 2015 at 7:47:22 PM UTC+1, Peter Wilkinson wrote:

    In the handler below WindSpeedDial() returns the svg to draw an image.

    *func handler(w http.ResponseWriter, r *http.Request) { *
    * db.OpenDatabase()*
    * fmt.Fprintf(w,svgo1.WindSpeedDial() )*
    *}*

    It works fine when called as page in its own right with e.g. *http://www.example.com/svgPage.fgci
    <http://www.example.com/svgPage.fgci>*

    However, when called from another page as the *src* for an image like
    this:

    * <img id="windspeed" src="http://www.example.com/svgPage.fgci
    <http://www.example.com/svgPage.fgci>" alt="wind speed" style="width:
    100%"> *

    nothing happens at all. Just no output. No mention in apache error log

    Any ideas?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 6, '15 at 6:47p
activeDec 7, '15 at 8:42a
posts3
users2
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase