Closed ImranGholizadeh closed 2 years ago
Schemes cannot be dynamic. Furthermore, Apple forbids any well-known protocol to be in schemes, including https
.
For client-side routing, common practice is to use a hash-based strategy in cordova apps. Pretty url strategies are desirable for traditional websites as the URL is visible but they also require a web server to properly route all urls to the same base web application to handle reloads and such.
In cordova, there is no webserver, and the user cannot see the URL, so hash-based routing is generally a sufficient solution.
If your QR reader expects a https://...
url, then I don't think it's going to work in a cordova environment.
So instead of using the domain name as your variables, you can use other parts of the URL as your variables, and have your application respond to URL changes via hashchange
event & read/parses the URL.
Closing this because this doesn't appear to be a bug. You can ask our slack community for support style questions.
I once implemented a plugin to switch the scheme at runtime. It's very experimental and you have to be a bit careful to make it work properly but it can be useful in some cases. https://github.com/GEDYSIntraWare/cordova-plugin-webview-switch
But Norman is right you cannot use http or https.
I want to change the scheme and hostname in my app to a custom URL scheme that has dynamic url params. Because the URL params are dynamic (using vue.js router) the app needs to account for rendering specific UI and data based on the param.
For instance, I have a QR reader that redirects the user to a view that renders UI based on the URL param id.. So the QR reader redirects the user to a view such as https://xxxxxxxx.com/12345 where the param id is 12345.
In that case, how should I alter the code from my config.xml file below?
Building the app in Vue.js and using https://github.com/m0dch3n/vue-cli-plugin-cordova as a codova plugin.