Post

Replies

Boosts

Views

Activity

Can we use allowFileAccessFromFileURLs=true to access file:// urls from an app?
In our game app, we have screens before/after game levels which are transparent wk webviews. This works great. We have interesting, complex css-based animations. We recently added some Lottie animations, which use a javascript fetch() on a .json file, and that throws a CORS error since you can't normally fetch file:// urls from the app bundle.  The error is eliminated if we set allowFileAccessFromFileURLs to true, but it's an undocumented preference of webkit (not a secret iOS method). It's clearly included in the public WebKit github (in WKPreferences.mm). We have other ideas for workaround, such as JS injection.  Is allowFileAccessFromFileURLs OK to set to TRUE?  Is it a risk of app rejection, and/or a significant risk of being removed int he future, and/or and otherwise bad idea? Do you have any other tips about loading data into web views in-app?
3
0
6.7k
Jan ’23