Alex Rivera | Logout

How to use @font-face on a Chrome Extension in a Content Script

Asked 2010-12-26T23:17:30.677
28

Since I can't use chrome.extension.getURL() on a CSS file, how can I use @font-face with a local font file?

Edit
Report

1 Answer

-3

Just use a relative URL. It's simpler, cleaner, and is The Right Thing To Do™:

@font-face {
    font-family: 'FontAwesome';
    src: url('../font/fontawesome-webfont.eot');
}

I know this question is old but it's a top result on Google and the accepted answer is inefficient.

EDIT: It seems that others are getting mixed results for this. I should mention that it probably doesn't work when used in Content Scripts. I've tested this in Popup Scripts and it works fine.

answered 2012-10-24T22:39:39.250

Your Answer