4

I'm trying to get this simple code to work:

<a href="#" target="_blank" style="display: inline-block;">
    <object data="icons/chrome.svg" type="image/svg+xml" style="pointer-events: none;">
        fallback text
    </object>
</a>

When I use

data="http://images3.wikia.nocookie.net/__cb20120330024139/logopedia/images/d/d7/Google_Chrome_logo_2011.svg" 

it works. However when I save that exact file onto my own server and reference it as above, it just shows the fallback text in Firefox. In Chrome it downloads the file when I open the page (which proves that the file link is correct).

Anyone know what's going on here?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
vee
  • 69
  • 1
  • 1
  • 4

2 Answers2

9

I can think of four possibilities:

  1. Your server is using the wrong MIME type for SVG images. (Can be fixed by adding AddType image/svg+xml svg to your .htaccess file; other methods discussed here)

  2. You saved the SVG file somewhere else and it doesn't exist at icons/chrome.svg. (Try navigating straight to the SVG file at icons/chrome.svg. Does it display in your browser?)

  3. You saved the file with insufficient permissions, resulting in your web server being unable to access the file. (Can be fixed by navigating to the icons directory and typing chmod 0644 chrome.svg at the command line prompt.)

  4. The file you downloaded from nocookie.net isn't actually an SVG file at all. (Try opening it inside a text editor.)

r3mainer
  • 23,981
  • 3
  • 51
  • 88
  • Thanks for your reply. I think the issue was #1. While the .htaccess file did not work, I was able to get SVGs to show up from my server by putting this in a web.config file at the root: ` ` For reference I'm using Godaddy hosting. I am now having an issue where the link is not working but I am investigating that. – vee Dec 09 '14 at 00:13
0

I was experiencing the first of the problems described by @r3mainer.

On my lighttpd server the problem was caused by the missing

  ".svg"          =>      "image/svg+xml",

line in the mimetype.assign section of the lighttpd configuration file.

Scrooge McDuck
  • 372
  • 2
  • 14