--- title: 与SVG、Mozilla有关的常见问题 slug: Web/SVG/FAQ tags: - SVG - SVG FAQ - 需要更新 translation_of: Archive/Mozilla/SVG_FAQ ---
我们目前维护了两个文档用来帮助回答这个问题:status page for SVG in Firefox 1.5+ 和 a status page for SVG in the development trunk.
这有两种可能的原因:SVG文件中有一个小错误,或者服务器配置不对。
如果源码的顶部有灰色区域,灰色区域里有文字“This XML file does not appear to have any style information associated with it(该XML文件找不到任何与它关联的样式信息)”,则问题是与SVG关。作为一个合未能的根SVG文件中的<svg>标签,必须至少跟随两个“命名空间绑定”。
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
实际上第二个绑定并非总是必要的,但是除非你了解命名空间,我们强烈建议你包含它。欲了解更多信息,请看这个链接。
If source code is displayed without a gray area at the top, or if you just see gibberish, then the problem is server misconfiguration. When servers send user agents an SVG file they must tell the user agent that the file has the MIME type "image/svg+xml", and if the SVG file is stored gzipped they must tell the browser that too. Mozilla is strict about this, and no, it's not a bug. Failing to respect the MIME types servers send is incorrect and has been a source of security holes in other browsers. Mozilla will not be changing this behaviour. For more information on server configuration for SVG see this link.
This is an XML debugging message to help XML authors correct errors in their XML documents. Mozilla will show this message when there's an XML well formedness error in the file it tried to load. (It doesn't mean there's an error in Mozilla.) There are many different XML errors, but the most common one in SVG files is "XML Parsing Error: prefix not bound to a namespace". This is (almost certainly) because the 'xmlns:xlink' attribute has been used in the file without including the following two namespace bindings on the root <svg>
tag.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
确保你的所有的SVG文件都绑定了它。欲了解更多信息请阅读这个链接。
When you try to load SVG files from some websites you may get a dialogue asking you "What should Firefox do with this file?". This is either because your browser doesn't support SVG (you must have Mozilla Firefox 1.5 or newer), or because the webpage/server isn't correctly telling Mozilla that the file contains SVG. For example, webpages that embed SVG using the <object>
or <embed>
tags must have a 'type' attribute assigned with the correct SVG MIME type of "image/svg+xml". If the MIME type specified is wrong (for example image/svg-xml) Mozilla won't recognise it. If that isn't the problem, then it may be that the server hosting the website is misconfigured. For information on configuring servers for SVG see this link.
This is probably because there is an <embed>
or <object>
tag in the HTML page and its 'type' attribute is set to the wrong MIME type. The SVG MIME type is image/svg+xml
(not image/svg-xml
or anything else for that matter). Correct this mistake or ask the document maintainer to correct it.
If you discover any problems with our SVG implementation that you think we should know about then we'd like to hear from you. To help us make the best use of our time, please first search in the SVG component of our bug database to check that the issue hasn't already been reported. If you can't find a matching bug please file a new SVG bug report, preferably attaching a (very small!) SVG file that demonstrates the bug. If you have any problems with the bug database feel free to contact contact us.
Individuals can choose to use a plugin to view SVG in Mozilla on their own computers, but there is no way for SVG content authors to make Mozilla use a plugin when people view the SVG files on their website. The native SVG support must be turned off before Mozilla will look to see if there's an SVG plugin installed. This is done by toggling a hidden user configuration preference (pref). To access the pref type about:config
into the URL bar, then type svg.enabled
into the Filter field. When you double click on the pref you will see its value change to and from true/false, turning the native support on/off.
Mozilla's native implementation is less complete than Adobe SVG Viewer's in general. There are major features such as filters and SMIL based animation that have still to be implemented in Mozilla. However, Mozilla's implementation already supports some things that Adobe's lacks, particularly parts of the XML and SVG DOMs. For example we support SVG exceptions and SVGTransform objects.
The SVG project is about Mozilla's native implementation of SVG, not Adobe/Corel/whoever's plug-in. However, we might as well answer this question to save you searching for this information elsewhere. See these install instructions on mozdev.org. It's also useful to know that you can check whether Mozilla has recognised your plug-ins by typing 'about:plugins' into your address bar (linking to that doesn't work for security reasons).
There are reports that it does, but that it's slower than the Adobe plug-in. See this document for information on how to install it.
Yes. If the plug-in works with the equivalent non-SVG version of Mozilla, then it should also work in the SVG enabled version. To be able to use it, you must make sure the svg.enabled pref is set to false. This will disable the native SVG support.
<embed>
标签支持SVG文档吗?Yes. As of 2004-11-11, builds with native SVG support will use the native support to render SVG documents that are embeded by reference into an HTML document using the <embed>
tag. Note that this capability was added to support legacy content. The <object>
tag should be used in preference to the <embed>
tag in new content whenever possible.
The first milestone builds that will have this support will be SVG enabled builds of Firefox 1.5.
Okay so maybe this isn't such a frequently asked question, but if it was, just think how much further on with our SVG implementation we could be! We're always looking for help from anyone willing to lend a hand. If you're a C++ programmer interested in working on the SVG implementation, please contact us and we'll be happy to help you get involved. Alternatively, if you're an SVG user you can help by testing the SVG enabled nightlies and filing bugs with minimal testcases whenever you encounter a problem. If you can't do either of these things you should still feel free to ask us friendly questions and give us constructive feedback.
Other than reviewing patches and fixing the occassional bug, Alex is currently taking a break from active SVG development to concentrate on 'real work' and cool stuff like XTF and JSSh. Tim is working on implementing <filter>
and working on items that need to be done before turning on SVG by default. After recently implementing gradients, Scooter is working on fixing some issues that remain outstanding and fixing <switch>
. Jonathan is working on various bugs, especially those that need to be fixed before SVG can be enabled in the official builds. David continues to create SVG enabled nightlies and answer build related questions as he has done for some time. Finally, occasional fixes are provided by other Mozilla hackers.
The best way to get in contact with us is to join the #svg channel on mozilla.org's IRC server. This is where most of us hang out to discuss issues relating to the SVG implementation. If you don't have an IRC client then install ChatZilla into Mozilla/Mozilla Firefox (note it may already be built in). Clicking on the link above should then take you straight there. If you'd prefer to contact us by email you can send an email to our newsgroup mozilla.dev.tech.svg which is archived here. Alternatively you can email any of us directly of course (see the preceeding question for our email addresses).
{{ languages( { "ja": "ja/Mozilla_SVG_Project_FAQ" } ) }}