views:

195

answers:

2

I was experimenting with the fancy new OpenType font capability in Firefox 3.5 and I ran into a problem. I was trying to embed a font on a different domain than the page it would be used on, and it didn't work. I thought it may have been a bug, but from what I read on the MDC reference page, I noticed this note:

In Gecko, web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless HTTP access controls are used to relax this restriction.

It looks like they designed the browser that way on purpose. Out of curiosity, why would they do that? Is there any security risk with embedding a font? Or is it for legal trademark or copyright issues? Or something else?

A: 

Legal trademark and copyright issues sometimes restrict the usage based on domain when embedding fonts.

Edit: That's why you should always look at the tiny letters on the font license that you might buy. If you created it, then you have full ownership and no problems at all.

P.S: I am not a lawyer, but can confirm the case with several customers of mine.

jpabluz
+2  A: 

If you want to bypass it you could try adding this to your .htaccess:

Header set Access-Control-Allow-Origin *

To answer your question, it's probably related to the fact that since version 3.5 Firefox supports the cross-origin sharing standard.

Knu
I get the idea of the standard, and I know how to set the access control headers. I am asking why they decided to have these restrictions on fonts.
mikez302
"The CSS @font-face construct prohibits cross-origin loads. With the resource sharing policy someone could set up a Web service that sells font licenses to selected servers and handles caching and bandwidth usage for them." from the source
Knu
Note that this header has to be set on the site containing the fonts. I encountered this because my fonts were on static.example.com, but my site was www.example.com. In a similar case, it is better to specify the sites to allow access, just to prevent someone from hotlinking your fonts, like this: `Header set Access-Control-Allow-Origin: http://www.example.com`
Kip