SVG doesn't work on subdomain - some browsers try to download rather than display
Posted
by
John Catterfeld
on Server Fault
See other posts from Server Fault
or by John Catterfeld
Published on 2013-10-23T19:59:15Z
Indexed on
2013/10/23
21:55 UTC
Read the original article
Hit count: 254
I have a site with a 'development' subdomain, which displays my SVG file exactly as intended.
However when I copy it across to www, or any other subdomain (e.g. 'test') some browsers try to open the file in an external editor, therefore asking me to download the file rather than displaying it.
For example:
- http://development.mysite.com/test.svg - works
- http://www.mysite.com/test.svg - doesn't work
The SVG file:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" />
</svg>
This happens in Firefox, Chrome and Safari, however IE9 and above display the file as intended.
It is a Windows hosting, and I have <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
in my web.config file
My hunch is that there must be some setting on the server which I need my hosting company to make. Can anyone suggest what might cause this issue?
© Server Fault or respective owner