iconic / SVGInjector

Fast, caching, dynamic inline SVG DOM injection library
MIT License
975 stars 145 forks source link

Doesn't work in safari #47

Open nazarposhta opened 8 years ago

nazarposhta commented 8 years ago

Hello everyone! I included my SVG element like that: <img id="thumb-icon" class="inject-me" src="/images/svg/innovate.svg" title="Preview" alt="Preview"> it works good in chrome but only "Preview" message in safari. Safari's console said me that: Unable to load SVG file: /images/svg/innovate.svg How I can manage that problem? Some idea?

jeffsilva90 commented 8 years ago

Just remove the first slash in the src attribute: src="/images/svg/innovate.svg" to src="images/svg/innovate.svg"

And another bug I've discovered in Safari is that if you decide to define a width value in the tag <img>, you have to define the height as well. I think the best way is to leave it blank and control the width with css styles. Otherwhise it will return a NaN value :(

Hope this could help you :D

markadrake commented 7 years ago

Sorry but those are 2 different paths up above. One is relative to the domain (or base URL) and the other is to the page you're current on.

@nazarposhta are you still having issues in Safari with this library? Could you please provide a CodePen or JSFiddle link?

Hopefully you have resolved the issue. If this isn't an issue any longer could you please close it? It appears as if the library doesn't work with Safari. Thanks.

tobireif commented 7 years ago

@nazarposhta is this still an issue?