FEA5T opened a new issue #398: URL: https://github.com/apache/cordova-windows/issues/398
# Bug Report Absolute (root relative) paths do not resolve to www folder, instead point to C:\... causing failed requests in the webapp. ## Problem Webapps that run normally on a webserver cannot be ported over to cordova because all absolute (root relative) paths fail. ### What is expected to happen? Absolute (root relative) paths should resolve to www folder which is consistent across iOS, android, windows, etc rather than pointing to an inconsistent drive root where the path differs. ### What does actually happen? Absolute (root relative) paths in your web app resolve to the drive root causing requests to fail that would succeed in any other server environment. ## Information <!-- Include all relevant information that might help understand and reproduce the problem --> Cordova behaves inconsistently and breaks a core principle of its own product: that you should be able to package and run a web app without rewriting it natively. ### Command or Code <!-- What command or code is needed to reproduce the problem? --> All absolute (root relative) paths in html and JS UI code should resolve to the www folder. At a bare minimum there should be a configuration as to where these paths point, so that the www folder can be targeted. There are many reasons for this: 1. **Consistency**: an app that runs in browser off a webserver should be portable to cordova with minimal changes. 2. **Sandboxing**: a web UI should not be concerned with, or be knowledgeable of a devices root drives and folder structure, instead it should only be knowledgeable of it's own root application folder. 3. **SPA necessity**: Relative paths do not work in a modern web UI with a router (take for example react or a vue app with vue-router): often times the route that the application is at will change, invalidating relative paths inside reusable component code. If a component relies on path "components/tabs.vue" and the browser is at path "www.mydomain.com/" the component will load, but if the browser is at "www.mydomain.com/movies/1234" then it will try to load "www.mydomain.com/movies/1234/components/tabs.vue" which will fail. Absolute (root relative) paths are necessary to prevent these errors and cordova should respect standards and point absolute paths at the www root folder. ### Environment, Platform, Device <!-- In what environment, on what platform or on which device are you experiencing the issue? --> On all environments/devices. There are many questions/complaints about this behavior and there is no known workaround, only suggestions to use relative paths (which do not work/are not compatible with SPA routers). ### Version information <!-- What are relevant versions you are using? For example: Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins Other Frameworks: Ionic Framework and CLI version Operating System, Android Studio, Xcode etc. --> ## Checklist <!-- Please check the boxes by putting an x in the [ ] like so: [x] --> - [x] I searched for existing GitHub issues - [x] I updated all Cordova tooling to most recent version - [x] I included all the necessary information above -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
