I have set up a very basic web project with the following files:
- index.html
- styles.css
- scripts.js
I have included the following line in the head of my html file:
<link href="https://unpkg.com/[email protected]/dist/css/ionicons.min.css" rel="stylesheet">
I am using the icons like so in my html file:
<i class="icon ion-md-menu"></i>
The icon was displaying properly but now i am receiving a CORS error when previewing the project.
Access to font at 'https://unpkg.com/[email protected]/dist/fonts/ionicons.woff2?v=4.5.9-1' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Not sure why i am receiving the error now when it was working just fine before. Any ideas how to fix this issue? Thanks.
https://unpkg.com/[email protected]/dist/fonts/ionicons.woff2— because that’s the URLhttps://unpkg.com/[email protected]/dist/fonts/ionicons.woff2?v=4.5.9-1redirects to. But the problem is, the 302 redirect response that server sends has anaccess-control-allow-origin: https://www.medical-care.netresponse header, which means the browser will only follow that redirect if the document making the request is hosted underhttps://www.medical-care.net. - sideshowbarkerhttps://unpkg.com/[email protected]/dist/css/ionicons.min.csswas giving me the same issue (had been using that for a year with no issues). Upgrade tohttps://unpkg.com/[email protected]/dist/css/ionicons.min.cssand the issue was resolved. I guess unpkg are having some config issues? - Tspoonhttps://unpkg.com/[email protected]/dist/css/ionicons.min.cssas @Tspoon suggested has the icons displaying properly for me. - Nizzy