psycho
psycho

Reputation: 1631

Cross Domain error while using fonts

I have come across an error when trying to access my site with http://www.example.com instead of http://eample.com. My font icons will not load. So when searching for the solution to this I came across the following solution which was adding the below code to a .htaccess file on the server.

<FilesMatch "\.(svg|ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "http://example.com, http://www.example.com"
</IfModule>

This managed to fix the problem but for Chrome only. How can i fix the issue for all browsers.

Thank you

Upvotes: 0

Views: 193

Answers (1)

Karl
Karl

Reputation: 5473

Try using:

href="/css/font-awesome.min.css"

This will be relative to the domain they visitor is on, so if they connect to either http:// or http://www the fonts will load and there won't be a cross domain error

Upvotes: 1

Related Questions