[HTML5] Font not loading

I’ve been hammering on getting fonts to load properly in HTML5 but can’t seem to get my head around it. The error I’m getting when loading in Chrome is:

XMLHttpRequest cannot load file:///C:/Users/Luke/Desktop/Github/ColourID/bin/html5/bin/font/OpenSans-Italic.eot.
Cross origin requests are only supported for protocol schemes: http, data, chrome, 
chrome-extension, https, chrome-extension-resource.

What’s strange about this error is that it’s not a cross-origin request, because both the web page and file request are hosted on the same domain, that being my local computer. Microsoft Edge, while it does not report the above error, also seems to be stuck on the loading screen as if the same error is occurring.

Despite, this I tried to toy around with HTTPRequest file to load a file using the now standard File API for html5, but couldn’t get it to function properly. I’ve lost the code before returning back to the original file state, so I can’t share it if you were curious what the code was (sorry!)

If I remove text entirely and all the font files, the application runs fine.

I can’t get my head around the stupidity of HTML5, so I’m hoping someone with a lot of knowledge of it can help me here. Thanks in advance.

I have encountered the font loading errors many times, while development. Unfortunately, I too never got a better understanding why it pops up, and how it solves automatically some times. The symptoms are similar, like the loader bar stucks in between, the font loading error shows on one browser but not on another. In one case, I had the error showing, but the fonts were all loading fine. :slight_smile:

I do remember, I solved it once, by cleaning up my build, compiling it all again, and put a new location for font assets in the application configuration xml. You can try that, if it solves the problem.

Okay, after doing what @singmajesty had suggested on fleep, using openfl test actually did the trick.

Setting up a local neko dev server also helps, which I completely forgot about considering.