45

I get an error message saying that jQuery couldn't find the path to the glyphicons-halflings-regular.woff2. The error shows up when the function for successful AJAX request is ran. In that function I inserted a hyperlink that uses a glyphicon from Twitter Bootstrap.

Looking at the path, I am sure that it is the correct path so I don't know why it's giving me the error. How could I fix this error?

Screenshot of the error

5
  • 1
    How are you accessing this page (what http server)? Have you tried opening the URL directly? What are the permissions on the fonts directory and this specific file?
    – Joseph
    Mar 25, 2015 at 14:23
  • I accessed the page through IIS Express. I have tried to open the URL directly and received 404 message. The permission is the same with the folder that contains glyphicons-halflings-regular.woff file, so it should be ok.
    – Johan G
    Mar 25, 2015 at 14:27
  • If you cannot access the URL directly, you won't be able to do it with an AJAX call. Verify the file exists and that you don't have any typos in the URL / filename.
    – Joseph
    Mar 25, 2015 at 16:52
  • The screenshot that I attached shows that I do have the file in the right path.
    – Johan G
    Mar 25, 2015 at 19:49
  • @JohanGunawan How did you resolve this issue?
    – LP13
    May 24, 2016 at 19:47

3 Answers 3

75

Using IIS I fixed it inside the Web.config-file, add the following inside <system.webServer>:

<staticContent>
    <remove fileExtension=".woff" />
    <remove fileExtension=".woff2" />
    <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
    <mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
</staticContent>

Notice I remove the extensions first, in case they already exist.

1
  • Should final line be <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />?
    – nmit026
    Nov 14, 2016 at 4:45
54

To get it to work with IIS Express you need to add the mime type. In a text editor open the file in your Documents folder at %UserProfile%\Documents\IISExpress\config\applicationhost.config

Search for a line that looks like this:

<mimeMap fileExtension=".woff" mimeType="font/x-woff" />

I would recommend changing it as the official MIME type has changed, but regardless simply copy that line and add a new one and change the fileExtension to .woff2 in the new one. Here is my modified file (with the corrected MIME types)

<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
1
  • This solved my issue in IIS after i added woff2 mime type site started to load woff2 fonts.
    – Peter M.
    Jun 2, 2015 at 23:00
5

If you prefer to work in the IIS GUI or aren't comfortable with command line or config files, follow the steps below.

To resolve the error retrieving glyphicons-halflings-regular.woff2 in IIS, you just need to add a MIME type for woff2.

  1. Open IIS and Select your server
  2. In the Features View, select MIME Types
  3. Click Add... in the Actions pane (top-right corner)
  4. Enter the File name extension of .woff2
  5. Enter the MIME type of application/font-woff

Also, as palehorse noted, ensure the MIME type for both .woff and .woff2 are application/font-woff

Sources:

1
  • The GUI's always going to be the safest place to do these things. +1
    – dewd
    May 5, 2016 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.