I’m trying to load a local stylesheet with font-family references (locally stored fonts). All of my Google font stylesheets load fine but this one generates the error:
“Did not parse stylesheet at ‘http://127.0.0.1:27785/fonts/fonts.css’ because non CSS MIME types are not allowed in strict mode.”
I have this reference in my app.HTMLHeader:
Anyone else run into this?
You cannot access a file on a folder on the disk like that.
You need to serve the file through HandleURL, which is made precisely to emulate folders like /fonts on top of your app. Put your CSS in a constant, and do a Request.Print(fontCssConstant) when you see fonts in Request.Path.
Or create a webfile pointing to your local fonts.css in App, and use a pagesource EditSource event on the webpage to add the line to the page header.
If you are versed enough in CSS, you can also modify the HTMHeader in the webpage Shown event.
Sorry, I meant “If you are versed enough in JavaScript,”.
It is indeed possible in JavaScript to modify dynamically the HTMLHeader.
So you got three possible solutions, the first one letting you do something analogous to what you tried.