Feature request: Local fallback on Font Awesome Kit CDN/SRI failure #20951
Replies: 12 comments
-
|
+1 to show my support for this request. |
Beta Was this translation helpful? Give feedback.
-
|
+1 from me as well. This is a more important issue than you may realize. We do not use the CDN because there is no fallback mechanism, and half the buttons on our site are font-awesome icons, so the site would be unusable if the CDN failed. We need a way to detect failure so that we can load a local version of the .js file. This is probably the easiest feature request you will ever receive. I believe all you need to do is put a global variable in your js file, maybe name it something like |
Beta Was this translation helpful? Give feedback.
-
|
Hi, the kit should expose edit: |
Beta Was this translation helpful? Give feedback.
-
|
Hi @tagliala , Yes, I see both In the fallback logic should I check for just one of them or both of them? (I did not understand what you mean by "Then it will load the actual framework, but it will be another call that may fail") |
Beta Was this translation helpful? Give feedback.
-
|
Using the SVG with JavaScript version of Font Awesome will set a public (as in we guarantee we will not change this) attribute on |
Beta Was this translation helpful? Give feedback.
-
Hi, I mean that the first request will just load the kit configuration, that will make a second (async) request to load the SVG framework ( Demo: https://jsfiddle.net/tagliala/0r5L9dfz/45/ In other words, this approach does not guarantee that the icons are available, you should check the document after it is has been completely loaded. |
Beta Was this translation helpful? Give feedback.
-
|
I just realized that when using the pro version of the font awesome kit (paid account) both the I ask because I was using Edit: Never mind. I realized that the free kit was by default set to use Web Font technology rather than SVG. Once I changed it to SVG the |
Beta Was this translation helpful? Give feedback.
-
|
@robmadole and @tagliala - Unfortunately the approach did not work. Although Here is what my code looks like: At the time of code execution, window.FontAwesome is undefined. so the local source gets used every time. This means there is no point in using the kit url since the local file will always get used. Do you have any suggestions on how to resolve this? |
Beta Was this translation helpful? Give feedback.
-
Confirm Please refer to #15159 (comment) |
Beta Was this translation helpful? Give feedback.
-
|
Ok, so then the only way to do the fallback test is to run it after the entire page (including scripts) have finished loading (aka after window.onload). Here is my new code that seems to be working, in case anyone else is interested - |
Beta Was this translation helpful? Give feedback.
-
|
@garyapps thanks, I've updated my fiddle to include your approach |
Beta Was this translation helpful? Give feedback.
-
|
This is a useful discussion — having clear, consistent icons makes a big difference in usability. Whether it’s icons in a UI or status markers on a tracking page, clarity helps users understand information quickly without confusion. On sites like locate parcels, for example, having intuitive visual indicators for shipment status makes it much easier to follow where a parcel is at a glance. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
If the CDN resource (Font Awesome CDN, or other such as cdnjs, jsDelivr, etc) cannot be loaded for any reason, or the SRI hash check fails for any reason, Font Awesome won't be loaded.
Describe the solution you'd like
There should be a way to perform a check for such a failure so that if it happens, it can fallback to a local copy of the resource. Is there a way to do this with Font Awesome? I use a FA Kit, but it could just as easily be for a third-party CDN-loaded resource.
Describe alternatives you've considered
N/A
Additional context
For example, this can be done using jQuery as follows:
Feature request checklist
Feature request: moar cowbell)Beta Was this translation helpful? Give feedback.
All reactions