nonameShijian commented on issue #1693: URL: https://github.com/apache/cordova-android/issues/1693#issuecomment-1946507912
> > I used Cordova version 10.0 to create an offline web game, which provides the WebViewAssetLoader class to access local web pages using HTTPS URLs. > > But for the convenience of users to replace files, I want this webpage to display files stored in the external directory of the phone. The directory address is equivalent to 'cordova.file.externalApplicationStorageDirectory', so I made some modifications to the source code of CordovaLib. > > This is something I don't think is tested but does service workers work as expected while using internal storage (e.g. if you place your service worker in your `www` folder)? > > I wouldn't expect external storage to work and there are security implications in launching scripts from external storage. Your scripts should be part of your android bundle. > > While within the Android OS, android's permission model can restrict applications from accessing or modifying app-specific files on external storage, but the external storage could be on a removable medium and if that storage medium is inserted into another device, say a PC, the file contents of app-specific external files could be manipulated. Therefore applications should treat scripts on external storage as untrusted and unsafe code. Just now, I placed 'service worker. js' in the' asset/www 'directory and called the same interface, but still prompted registration failure. ![bd8f176879794d19b2354864a86155e7](https://github.com/apache/cordova-android/assets/88574031/5b89604a-319d-4536-b4ad-ec91cf512a45) I know that storing startup scripts from external sources does pose security risks, but the web framework used in the game has been in place for a long time and is difficult to modify. The purpose of opening extension interfaces in the game was to allow players to easily modify source code files to achieve the desired effect, and players also have a clear understanding of what modifying source files represents. -- 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. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org