Google Fonts giving: No 'Access-Control-Allow-Origin' header is present on the requested resource

deweydb picture deweydb · Sep 5, 2014 · Viewed 8.2k times · Source

I'm trying to use a google font 'Oswald'. When i embed it into my page in the recommended way:

<link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css'>

Chrome throws the following error:

XMLHttpRequest cannot load http://fonts.googleapis.com/css?family=Oswald:400,300,700. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://<<redacted>>' is therefore not allowed access. 

Is this just a mistake on google's part or am i doing something wrong?

Answer

deweydb picture deweydb · Sep 9, 2014

Turns out it was a conflict with prefixfree

Solution was to add "data-noprefix" to the link tag, like so:

<link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css' data-noprefix>