Environment
nativescript-vue: 2.4.0
nativescript: 6.2.2
tns-core-modules: 6.2.3
tns-android: 6.0.0
tns-ios: 6.0.1
iPhone Xs 13.1.3
Describe the bug
I cannot access files in a webview while in development on a physical device. However, building for production is fine.
Below shows the code I am using to create the absolute path which includes encodeURI.
const fileSystemModule = require("tns-core-modules/file-system");
...
currentApp(path) {
return encodeURI("file:///" + fileSystemModule.knownFolders.currentApp().path + "/" + path);
},
...
/*
INPUT:
this.currentApp('assets/webview/basic.css');
Output:
file:////var/mobile/Containers/Data/Application/3D7C3732-1C06-4844-AE7F-981591082961/Library/Application%20Support/LiveSync/app/assets/webview/basic.css
*/
Expected behavior
The css file should be accessible in the webview and the webview background should be red with white text.
Sample project
https://github.com/7ammer/nativescript-webview-resource-issue
Additional context
I have noticed that the production and development builds show different paths. The development path contains a space (Application%20Support) which is encoded to %20 while the production build does not have any spaces in the path. I would have thought the encoded path would work but I guess not.
The issue does not appear on android devices.
Thanks :)
Reactions are currently unavailable
Environment
nativescript-vue: 2.4.0
nativescript: 6.2.2
tns-core-modules: 6.2.3
tns-android: 6.0.0
tns-ios: 6.0.1
iPhone Xs 13.1.3
Describe the bug
I cannot access files in a webview while in development on a physical device. However, building for production is fine.
Below shows the code I am using to create the absolute path which includes encodeURI.
const fileSystemModule = require("tns-core-modules/file-system"); ... currentApp(path) { return encodeURI("file:///" + fileSystemModule.knownFolders.currentApp().path + "/" + path); }, .../* INPUT: this.currentApp('assets/webview/basic.css'); Output: file:////var/mobile/Containers/Data/Application/3D7C3732-1C06-4844-AE7F-981591082961/Library/Application%20Support/LiveSync/app/assets/webview/basic.css */Expected behavior
The css file should be accessible in the webview and the webview background should be red with white text.
Sample project
https://github.com/7ammer/nativescript-webview-resource-issue
Additional context
I have noticed that the production and development builds show different paths. The development path contains a space (Application%20Support) which is encoded to %20 while the production build does not have any spaces in the path. I would have thought the encoded path would work but I guess not.
The issue does not appear on android devices.
Thanks :)