SVG图片<图片>通过GWT应用程序引用时,Firefox 16中不会显示标签 [英] SVG Image with <image> tags does not show up in Firefox 16 when referred through GWT application

查看:202
本文介绍了SVG图片<图片>通过GWT应用程序引用时,Firefox 16中不会显示标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我创建了一个新的 svg 文件(NewImage.svg )与< image> 标记:

 <?xml version =1.0encoding =ISO-8859-1?> 
<!DOCTYPE svg PUBLIC' - // W3C // DTD SVG 1.0 // EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD /svg10.dtd'>
< svg xmlns ='http://www.w3.org/2000/svg'
xmlns:xlink ='http://www.w3.org/1999/xlink'
width =224pxheight =54pxviewBox = - 0.58 -1.162 224 54>
< image xlink:href ='background.svg'width ='224'height = '54'/>
< image xlink:href ='foreground.svg'x = '12'y = '12'width = '32'height = '32'/>
< / svg>

当我打开 NewImage.svg 但是,当我从 GWT 应用程序中引用这个svg文件时,在Firefox 16中不会加载 NewImage.svg 。它在IE 9中的加载是正确的。

解决方案

所以你需要把你想要使用的任何资源放到数据中:URIs

I am facing this issue in Firefox 16.

I created a new svg file (NewImage.svg) with <image> tags:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
          'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg xmlns='http://www.w3.org/2000/svg'
 xmlns:xlink='http://www.w3.org/1999/xlink'
 width="224px" height="54px" viewBox="-0.58 -1.162 224 54">
     <image xlink:href='background.svg' width='224' height='54' />
     <image xlink:href='foreground.svg' x='12' y='12' width='32' height='32'/>
</svg>

When I open this NewImage.svg in Firefox directly, it opens perfectly.

However, when I refer to this svg file from inside my GWT application, the NewImage.svg does not load in Firefox 16. It does load correctly in IE 9.

解决方案

Gecko does not allow SVG loaded inside to load any external resources, for security reasons (basically to prevent images from phoning home when users won't expect them to). So you need to put any resources you want to use into data: URIs

这篇关于SVG图片&lt;图片&gt;通过GWT应用程序引用时,Firefox 16中不会显示标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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