Search code examples
cssfontscross-domaingoogle-font-api

how google bypasses the 'no cross-domain custom fonts' on Firefox


I want to have a small Webfont Service on our web site to be used by our customers.
I just want to know how Google bypasses cross-domain prohibition problem for font downloading ?

edit: I put this CSS on the server:

@font-face {
   font-family: 'Fascinate';
   font-style: normal;
   font-weight: 400;
   src: local('Fascinate'), local('Fascinate-Regular'), url('http://www.site.com/fontkit/fonts/fascinate.woff') format('woff');
}

and import it in localhost as below

<link href='http://www.site.com/fontkit/style.css' rel='stylesheet' type='text/css'>

this does not work but when i change the font url to google fonts, it works correctly. like this :

src: local('Fascinate'), local('Fascinate-Regular'), url('http://themes.googleusercontent.com/static/fonts/fascinate/v1/NnlsYos1mCtA9prs2JfnBT8E0i7KZn-EPnyo3HZu7kw.woff') format('woff');

Solution

  • Adding some codes to .htaccess (On the server) solved the problem

    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
        Header set Access-Control-Allow-Methods "GET"
        Header set Access-Control-Allow-Credentials "false"
    </IfModule>