breautek commented on issue #398: URL: https://github.com/apache/cordova-windows/issues/398#issuecomment-951267861
Cordova is just a packaging tool, it doesn't really implement any URL loading scheme, or the browser view itself. It's standard browser behaviour (including in traditional web server apps) that if you have a url prefixed with with a forward slash (`/`) then the URL should be treated as an absolute URL. We cannot change what the "root" directory is. However if you control the machines that you're deploying the cordova apps too, you might be able to chroot the process. If you want relative URLs, then you should not prefix with a forward slash. The urls will then be relative to the document itself, generally the path of where the HTML file resides. e.g. use `<script src="app.js" />` instead of `<script src="/app.js">`. It's recommended to use relative paths anyway to remain cross-platform as the paths for each platform is different. > that you should be able to package and run a web app without rewriting it natively. I don't think Cordova claims at any point that you can package up any web app without rewriting it. Cordova **does** claim that you can package up web apps so that you can deploy native apps with the majority of your app code being ran in the system provided webview, then deploy it via different platforms using largely the same codebase. It does not mean you can take any traditional web application hosted on a web server and package it up and it will work as is. There are differences between traditional web hosted environments and native apps with embedded web content. SPA does work in Cordova environments. but for routing you can't use "clean urls" which is often sought after in traditional web development for the purposes of clean looking URLS in the address bar and/or SEO purposes. In Cordova environments you have to use hash-based routing, because there is no intermediate web server that sits between your web app your source files that can be used to manipulate the routing. I'm closing this because changing what the root directory is - is not something Cordova can feasibly do. -- 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]
