getting a html page with SVG that works in ubuntu to display correctly in windows on firefox 5
I'm trying to get this page to display its SVG content correctly in Firefox 5 in Windows:
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<title>SVG Rich Text Editor</title>
<style type="text/css">
...
</style>
<script>
var gui //define a global varaible to pass it on between frames
</script>
</head>
<body>
<iframe id="toolbar" src ="toolbar.html" width="500px" height="50px" frameBorder="0"></iframe><br/>
<iframe id="editor" src="editor.svg" width="500px" height="500px" frameBorder="0"></iframe>
</body>
</html>
it works perfectly in Ubuntu but in Windows (Vista) when loading the page Firefox 5 asks me if I want to open or download the file instead of displaying it.
I've also tried it by using an object tag instead of an iframe tag. Again it works perfectly in Ubuntu but in Windows it wants to download a plug-in, which I don't mind except it doesn't find any.
I've checked and the HTML5 parser is automatically enabled in this version so that can't be it.
Does anyone know how to get this to work?
EDIT 3:
After changing my local server to print the header instead of doing the defau开发者_高级运维lt get I get this when loading http://localhost:8000/editor.svg:
Host: localhost:8000
User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:6.0) Gecko/20100101 Firefox/6.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: nl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
this is the top of in editor.svg
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
small note: there is some java script and css inside of the editor.
EDIT 4
I've created a small python program based on the one provided in the python documentation (http://docs.python.org/library/httplib.html#examples) and asked for editor.svg to get the response header:
'date': 'Sat, 20 Aug 2011 13:30:57 GMT'
'last-modified': 'Thu, 18 Aug 2011 11:34:42 GMT'
'content-length': '1986'</br>
'content-type': 'application/octet-stream'
'server': 'SimpleHTTP/0.6 Python/2.7.2'
I believe we have now confirmed it sees the svg as an application rather then an image. Question is how do you solve this? Preferably by adding some information in the svg itself instead of messing with the server.
Sounds like your local web server is sending the wrong MIME type for .svg files on Windows. What type is it sending?
Since SVG is a graphics format, have you tried simply using
<img src="editor.svg" width="500px" height="500px">
精彩评论