SVG< object>,< embed>不同浏览器的问题

SVG< object>,< embed>不同浏览器的问题

问题描述:

您好,


我在SVG中显示一些图表。它们是用PHP创建的,对于Safari没问题,插入如下:

Hi there,

I am displaying some graphs in SVG. They are created in PHP, and, for Safari no problem, inserted like this:

展开 | 选择 | Wrap | 行号

您需要指定宽度/高度的单位(px)。您还使用旧的doctype。它应该是:<!DOCTYPE svg PUBLIC" - // W3C // DTD SVG 1.1 // EN" http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">


如果没有第三方,SVG根本无法在IE中运行javascript库。现代浏览器不需要像你在这里使用它那样使用对象标签。
You need to specify the units (px) for the width/height. You are also using an old doctype. It should be: <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

SVG does not work in IE at all without a 3rd party javascript library. Modern browsers don''t need the object tag the way you''re using it here.


有2篇关于SVG的ALA文章:
使用SVG实现灵活,可扩展和有趣的背景,第一部分
使用SVG实现灵活,可扩展和有趣的背景,第二部分
there are 2 ALA articles about SVG:
Using SVG For Flexible, Scalable, and Fun Backgrounds, Part I
Using SVG For Flexible, Scalable, and Fun Backgrounds, Part II


非常感谢您的信息。我知道这些文章,并将它们部分用于指导。


我现在所做的是使用OBJECT标签包含生成和输出(不是单独的文件)SV​​G代码的PHP文件:

Thanks a lot for the info. I was aware of the articles, and used them partially for guidance.

What I did now was to use the OBJECT tag to include the PHP file which generates and outputs (not in a separate file) the SVG code:

展开 | 选择 | Wrap | 行号