SVG不是在Safari浏览器上绘图 [英] SVG not drawing on safari

查看:118
本文介绍了SVG不是在Safari浏览器上绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎Safari在渲染我的SVG时遇到一些问题,而其他浏览器正确地执行此操作。有什么想法吗?



以下是网址:



然而,真正的问题是您的< script> 元素引用jQuery时:
$ b

  < script src =// ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.jstype =text / javascript>< / script> 

在这个URI的前面输出一个正确的http:,你会发现你的页面正在工作如果你解决了其他两个问题)。


Seems Safari is having some problems rendering my SVG, while other browsers does it correctly. Any idea on what is wrong?

Here is the URL:

http://bcndevcon.org/dev/infographic/

I've seen a lot of examples using iFrame, I don't know if it has something to do with the problem.

Update: Seems server is sending the wrong content type, Content-Type: text/html

Update 2: In order to draw it correctly on all browsers use xhtml insted of html extension, for example: index.html

Newbie error :)

解决方案

You have an XHTML page being served as text/html. Change your server to serve your page as application/xhtml+xml, or include the following as the first element in the <head>:

<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />

If Safari is interpreting your XHTML page as HTML, it will not interpret SVG elements as anything other than custom markup.

For reference, here is an example of SVG in XHTML that works in Safari, including using JavaScript to create SVG elements.

Edit: Additionally, you have broken XHTML; your <link> tag is missing a self-closing marker; see the validation results.

The real problem, however, is that you have a broken URI for your <script> element when referencing jQuery:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>

Throw a proper "http:" at the front of that URI and you will find your page working (if you fix the other two problems).

这篇关于SVG不是在Safari浏览器上绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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