Search code examples
fontsgoogle-font-api

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


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?


Solution

  • 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>