I run my cordova app from internal storage file:///android_asset/index.html linking (via routes.js) locally downloaded files onto my storage which is file:///data/user/0/my.app/files/files/*.html
In the version 7 this worked without issue, but with version 8, the usage of Fetch() now gives the error when Framework7 is loading the new routes from file:///data/user/0/my.app/files/files/
The exact error shown in the console is:
Fetch API cannot load file:///data/user/0/my.app/files/files/pages/log.html URL scheme "file" is not supported
I now use a workaround to update the routes.js in code where I point to a version stored online, but you can imagine this is not a good solution. In case anyone needs this workaround, here is the actual code that solves this issue:
routes.forEach(function (aRoute){
if(aRoute.url) {
if(aRoute.url.includes('/pages/')) {
if (app_android) {
//Fetch does not allow file://
var tRouteUrl=aRoute.url.replace('/pages/','pages/');
var tNewUrl=server + '/' + tRouteUrl;
console.log('Updating route -- ' + aRoute.url +' -- to '+tNewUrl );
aRoute.url=tNewUrl;
}
}
}
if(aRoute.componentUrl) {
if(aRoute.componentUrl.includes('/pages/')) {
if (app_android) {
//Fetch does not allow file://
var tRouteUrl=aRoute.componentUrl.replace('/pages/','pages/');
var tNewUrl=server + '/' + tRouteUrl;
console.log('Updating route -- ' + aRoute.componentUrl +' -- to '+tNewUrl );
aRoute.componentUrl=tNewUrl;
}
}
}
});
}
Expected behavior
I expect that routes.js is able to use files that are stored locally with file:// links.
Describe the bug
I run my cordova app from internal storage file:///android_asset/index.html linking (via routes.js) locally downloaded files onto my storage which is file:///data/user/0/my.app/files/files/*.html
In the version 7 this worked without issue, but with version 8, the usage of Fetch() now gives the error when Framework7 is loading the new routes from file:///data/user/0/my.app/files/files/
The exact error shown in the console is:
Fetch API cannot load file:///data/user/0/my.app/files/files/pages/log.html URL scheme "file" is not supported
I now use a workaround to update the routes.js in code where I point to a version stored online, but you can imagine this is not a good solution. In case anyone needs this workaround, here is the actual code that solves this issue:
Expected behavior
I expect that routes.js is able to use files that are stored locally with file:// links.
Actual Behavior
API Exception with Fetch()