-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android 10 - How can I assign the root path? #1458
Comments
Root paths aren't assignable in Android. If you're using the filesystem strategy (e.g. When using the filesystem strategy, If you're using the <preference name="scheme" value="https" /> <!-- scheme can only accept "http" or "https" on android -->
<preference name="hostname" value="localhost" /> The configured scheme/domain will point to your
It's advised against using the
While I agree that this shouldn't be your primary solution, it should be an option for the foreseeable future.
This is a filesystem constant that is the absolute path to your app's Application Directory. If you're using this path while using the Assuming you're using |
Thanks so much Norman... I have submit my App on PlayStore and at the moment it's approved... using AndroidInsecureFileModeEnabled as true. I have to do it quickly (beforeGoogle conditions change) because I didn't want to lose months of work... but I want to be ready for next time and I want to use the WebViewAssetLoader strategy... so:
and the solution to assign an image But at this point I have anoter problem... in many part of my project I use window.resolveLocalFileSystemURL to find folders and files... like this example:
In this case if I set the urlDateFiles as "img/icons" the functions goes to error... if I use Do you have a suggestion about it? Is it better to mantain this solution or do you have to suggest me another one? |
I would advise to only use the I would recommend working towards making your app compatible with If you're creating dynamic content and writing files during runtime, using the file plugin, then it is ok to continue using the file plugin and it's constants to read that data or to resolve filesystem urls, but trying to use these paths with the webview will not work when |
Excuse my english... ... yes my target is write code with For example... I want to read the files stored inside img folder (www/img/icons)... for this need I use (now) window.resolveLocalFileSystemURL... but it doesen't work if I set
So as you can see your suggestion to use "img/icons/..." work fine to set the pathImg ... the problem is that window.resolveLocalFileSystemURL don't accept img/icons as urlFolderImage, but it need to use cordova.file.applicationDirectory+'www/img/icons' So the question is...
|
My suggestion about using the relative paths applies when you're using the DOM apis, such as pathing used in HTML or CSS (e.g. If you're using the cordova file plugin APIs including Understand that there are two different systems here. The standard webview APIs cannot use the |
Yes sure... but I like to convert all in only one system using the standard web view APis. Is there a way to read files with this method? Thanks for your support |
Not really sure if this is what you're looking for but the latest version of the So if you have a The URL given by But there is still no way to assign a root path like you were originally seeking out, but I think the above might be something useful to you. |
Sorry in advance if my english is not so good.
As breautek wonderfully explain here #1354 (comment) , with Android 10 Platform (the mximum platform available at the moment on Cordova and the minimum platform required to publish on playstore) "XHR not CORS request" and "file://" not working if I don't set on my config.xml
I'm pretty sure that this solution is useful... but temporary. I'm sure the PlayStore will impose a new restriction shortly and this solution will be in vain.
So I decided to not use them and carry on... I have solved my problem about XHR CORS request but I have no solution about how to set the root path... for example to assign it an image path
At the moment I get it as:
Obviously don't work on my app because the path is : " file:///android_asset/www/img/1.png"
I tried to use "https://localhost/www"
I tried to use "https://localhost"
I tried to use "/"
But nothing...
I there some other command or trick ???
The text was updated successfully, but these errors were encountered: