Search code examples
javascriptgoogle-chrome-extensionfirefox-addonfont-awesome

Font Awesome no longer working on browser Extension


I've had Font Awesome on my extension (Chrome & Firefox) for almost a year but now the icons no longer work:

Manifest:

...
"content_security_policy": "script-src 'self' https://kit.fontawesome.com/{id}.js; object-src 'self'"
}

Include:

<script src="https://kit.fontawesome.com/{id}.js" crossorigin="anonymous"></script>

An error in the console:

{id}.js:2 Font Awesome Kit: TypeError: Cannot read property 'classList' of null

Solution

  • After thinking about the answer I have discovered the solution. I logged into my Fontawesome account and grabbed the CDN version of the CSS link. This now works with no issue.

    I also added it to my manifest.json in the content_security_policy area.