jonathantneal / svg4everybody

Use external SVG spritemaps today
https://jonneal.dev/svg4everybody/
Other
3.29k stars 353 forks source link

LEGACY_SUPPORT is undefined #130

Closed Voo2 closed 7 years ago

Voo2 commented 7 years ago

I cannot use svg4everybody. I implemented it as it is in the manual. But I gets in each browser the error message "LEGACY_SUPPORT is undefined".

I've added the following two lines in the head area of my site:

<script src="libs/svg4everybody.js"></script>
<script>svg4everybody();</script>
Voo2 commented 7 years ago

after using a cdn (https://cdnjs.cloudflare.com/ajax/libs/svg4everybody/2.1.2/svg4everybody.js) I got a new error message:

Access denied File: svg4everybody.js, row: 68, column: 81

But this error message I get only in Internet Explorer 11.

timeiscoffee commented 7 years ago

@Voo2 LEGACY_SUPPORT is for grunt build. Please use /dist/svg4everybody.js instead!

Also, it seems like your XHR is failing on IE11 for some reason. I would check access to the svg file. Its working fine in IE11 for me

Voo2 commented 7 years ago

I used this version of the svg4everybody file.

timeiscoffee commented 7 years ago

@Voo2 could you provide more detail on this? e.g. link to the svg in question, test web page.

Voo2 commented 7 years ago

I've just found that when I upload the files to a webserver, everything works perfectly. If I call the index.html locally, then I get the above error message. Is it a problem for svg4everybody when running without webserver?

timeiscoffee commented 7 years ago

Ah that's probably just CORS issue, nothing specific to this library.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

You can try with turning off web security option on your browser, and it should work. (e.g. "Access data sources across domains" in IE)

Voo2 commented 7 years ago

I agree with this. It isn't specific to this library. The issue can be closed. Sorry for the circumstances.

shawnbot commented 7 years ago

Thanks for working through this, @timeiscoffee!