Loading ...
Sorry, an error occurred while loading the content.

Re: Caching SVG; using EMBED or OBJECT; problems with Javascript access

Expand Messages
  • philsvg
    Hi Stefan, for a discussion about tags to include svg, read http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#SVG_in_HTML from my point of view, i use
    Message 1 of 8 , Dec 31, 2011
    • 0 Attachment
      Hi Stefan,

      for a discussion about tags to include svg, read http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#SVG_in_HTML

      from my point of view, i use only embed tag since years and all work as expected ...

      In your php, your first line must be :
      header("Content-type: image/svg+xml");

      Hope this help
      Philippe
      http://www.visualkit.com

      PS : Happy new year to svg-developers readers :-)

      --- In svg-developers@yahoogroups.com, Stefan Schwarzer <st.schwarzer@...> wrote:
      >
      > Hi,
      >
      > I am wondering why in my case the OBJECT does not work when I call the cached SVG file. And the EMBED does not work when I call the PHP file.
      >
      > And even worse, my script to highlight a country line does work with OBJECT, but not with EMBED:
      >
      > <!-- highlight countries -->
      > <script type="text/javascript">
      > // access SVG object
      > var a = document.getElementById("svg_object");
      >
      > //it's important to add an load event listener to the object, as it will load the svg doc asynchronously
      > a.addEventListener("load",function()
      > {
      > var svgDoc = a.contentDocument; //get the inner DOM of svg_object
      > var delta = svgDoc.getElementById("g332"); //get the inner element by id
      > delta.setAttribute("visibility", "visible"); //add behaviour
      > },false);
      > </script>
      >
      > Any tip what I can do about it? Thanks for any suggestions.
      >
      > Stef
      >
      > >
      > >
      > > --- In svg-developers@yahoogroups.com, Jeff Schiller <codedread@> wrote:
      > > >
      > > > It's not clear to me why you need to use embed and not object for your
      > > > cached version.
      > > >
      > > > Can you have your PHP file check for the existence of the cached SVG file
      > > > on your server? If not present, generate the file. If present, send that
      > > > file's contents to the client.
      > > >
      > > > Jeff
      > > >
      > > > On Tue, Dec 20, 2011 at 6:55 AM, luftikus_143 <st.schwarzer@>wrote:
      > > >
      > > > > **
      > > > >
      > > > >
      > > > > Hi there,
      > > > >
      > > > > I would like to cache the SVG files which I generate via PHP. But it seems
      > > > > a bit difficult. When I first call the PHP file which produces the SVG, I
      > > > > use the OBJECT element to display it on the website:
      > > > >
      > > > > <object id='svg_object' data='data_vis_bars_svg.php' type='image/svg+xml'
      > > > > width='1150' height='500'></object>
      > > > >
      > > > > But when caching the SVG file, I can't use the OBJECT anymore, but must
      > > > > use the EMBED instead:
      > > > >
      > > > > <embed id='svg_object' src='../etc/cache/data_vis_bars_svg.svg'
      > > > > type='image/svg+xml' width='1150' height='500'></embed>
      > > > >
      > > > > Do you know of any intelligent workaround here? Not sure what I can do
      > > > > about this...
      > > > >
      > > > > Thanks for any hints!
      > > > >
      > > > >
      > > > >
      > > >
      > > >
      > > > [Non-text portions of this message have been removed]
      > > >
      > >
      > >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.