breautek commented on issue #1143:
URL: 
https://github.com/apache/cordova-android/issues/1143#issuecomment-745291431


   Is there a reason why you are requesting them over the internet? You really 
should just package those font files locally and request them locally instead 
of them.
   
   Your app should work well enough offline. Your app may have parts that 
require an internet connection, but it should at least be able to load up your 
base UI code. You will obviously be missing your font files (something a user 
may see as a buggy app if the font randomly changes) if the user tries using 
your app without an internet connection.
   
   To answer your question, it isn't easy to "intercept" a request in JS. A 
normal way of doing this would be via Service Workers, however they don't work 
in the android webview. You might be able to do this via creating your own 
[plugin](https://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/) and 
provide an implementation for:
   
   
https://github.com/apache/cordova-android/blob/55feadff0519fa294be34c22ff6fbb913efd1b48/framework/src/org/apache/cordova/CordovaPlugin.java#L292-L319
   
   But the challenge you'll face is "How do you detect if the file is in the 
chrome cache, and if so how do you obtain it so that you can read and serve 
it." At this point you're utilising a private implementation detail of the 
chrome webview, therefore it would be easier and more stable just to bundle 
your assets with your APK.
   
   Despite my effort of trying to give you a detailed answer, Apache Cordova 
doesn't provide support in GitHub Issues therefore I'll be closing this ticket. 
We use GitHub Issues are for tracking bugs or feature requests only. If you 
require further support, I do invite you to use our [Slack 
Community](http://slack.cordova.io/) instead.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to