Font Face download issue

Im working on an addon which injects an html element into the webpage and in that element that I inject I want to include some font that I have stored locally in the ‘data/fonts’ folder. Unfortunately I get this error
downloadable font: download not allowed (font-family: "Avenir LT W01_35 Light1475496" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed source: resource://gt-firefox/data/fonts/Avenir-light.ttf
Does anyone have any idea how I can get the fonts to work?

1 Like

This solution uses low level components not available to SDK I think. So you will need to use require('chrome')

I had a project where I hit this as well, but it was for Twitter. I used evalInSandbox -
http://www.stackoverflow.com/a/32013468/1828637

his topic links an article to MDN which gives the code that worked exactly for me on Twitter - http://www.stackoverflow.com/a/32495180/1828637

It likes to MDN here - https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.Sandbox#Example

Once inside the sandbox, try importing the resource. If it doesn’t work, make binary data out of and make a blob from within the sandbox, that way it shouldn’t see it as remote.

You sir are awesome! :smiley:

Best,
Irtza

Woohoo! So glad it worked. You’re awesome for actually taking the pointers and trying it all out, excellent job! :slight_smile: