I am trying to cache fonts natively in a hybrid app, so that CSS hosted in an https
website loaded in WKWebView
through loadRequest
can reference them like this for a performance boost:
@font-face {
font-family: 'MyFont';
src: url('my-assets://Gordita-bold-subset.woff') format('woff');
font-weight: normal;
font-style: normal; }
The problem happens when I register a WKURLSchemeHandler
for my-assets
.
The handler never gets called and the Safari Web Insepctor shows this:
[blocked] The page at https://www.x.com/ requested insecure content from my-assets://Gordita-bold-subset.woff. This content was blocked and must be served over HTTPS.
Interestingly enough, if we try to serve content with <img src="my-assets://test.png"
this restriction does not apply.
Are there any workarounds other than using the private API WKProcessPool._registerURLSchemeAsSecure
?