显示< svg>在iOS浏览器中使用< html>无需使用< embed>标签 [英] Display <svg> in iOS Browser using <html> without the use of the <embed> Tag

查看:95
本文介绍了显示< svg>在iOS浏览器中使用< html>无需使用< embed>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在iOS浏览器中的<html>中显示<svg>内容,而无需使用<embed><img>标记,这需要我存储<svg>内容放在单独的文件中?

Is it possible to display <svg> content inside an <html> in an iOS browser without the use of the <embed> or <img> tags which require me to store the <svg> content in a separate file?

<html>中嵌入<svg>内容似乎可以在所有其他现代浏览器(IE9,Chrome,甚至Window上的Safari!)上使用.

The embedding of <svg> content inside <html> seems to work on all other modern browsers (IE9, Chrome, even Safari on Window!).

我发现一些参考资料建议将内容类型更改为'text/xml'可能有用,但是由于我的代码作为SharePoint 2010中的移动服务器控件的一部分运行,因此我无法对其进行更改.

I have found some references that suggest changing the content-type to 'text/xml' might work, but I am not able to change it as my code is running as part of a mobile server control in SharePoint 2010.

我的页面包含几个<svg>区域,每个区域都显示一个简单的图形.这些图的数据存储在序列化对象中,该序列化对象需要先反序列化,然后才能绘制svg折线.由于反序列化过程非常耗时,因此我宁愿一次执行一次并一次生成所有图形,而不是生成对单个svg文件的资源引用,而该资源可以由<embed>标记引用.

My page contains several <svg> areas, each of which displays a simple graph. The data for these graphs is stored in a serialized object which needs to be deserialized before the svg polylines can be drawn. Since the deserialization process is time-consuming I prefer to do it once and generate all graphs in a single pass, rather than generating resource references to individual svg files which can be referenced by an <embed> tag.

:

There are indications that inline <svg> is supported in iOS5.

推荐答案

您可能需要在XHTML复合文档中使用内联SVG.在这种情况下,HTML根元素和内联SVG元素都使用XML名称空间.相关示例请参见此处:
http://www.croczilla.com/bits_and_pieces/svg/samples/dom1/dom1.xml

You may need to use inline SVG inside an XHTML compound document. In this case, XML namespaces are used for both the HTML root element and the inline SVG element. See here for a relevant example:
http://www.croczilla.com/bits_and_pieces/svg/samples/dom1/dom1.xml

可以在这里找到其他有用的示例:
http://www.croczilla.com/bits_and_pieces/svg/samples

Other useful examples may be found here:
http://www.croczilla.com/bits_and_pieces/svg/samples

这篇关于显示&lt; svg&gt;在iOS浏览器中使用&lt; html&gt;无需使用&lt; embed&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆