Wappler Version : 5.3.3
Operating System : Windows 11
Server Model: node.js
Database Type: sqlite
Hosting Type: local capacitor, but testing in browser at the moment.
Looks like I cannot define a route for the index.html page. Is this expected?
I was able to create content pages and navigate to those using links on the index.html page, but the URL shows index.html . Any way to have that rewritten to / or is this a limitation of the mobile app setup?
Here’s an example: http://localhost:63441/index.html#!/dashboard
I realize this will not be shown to users because there is no URL shown in mobile/desktop apps, just curious.
You could have a / instead of #!/ on the client, the only problem is that when you refresh the page you will get a 404 error when there is no server-side rewrites. The #! always works and doesn’t require any server-side rewrites.
Thanks Patrick, so it’s okay the routing http://localhost:63441/index.html#!/dashboard
I’m asking this beacuse I’m running in some issues with this:
if (window.location.pathname === "/index.html") {
console.log("true");
} else {
console.log("false");
It will always return true because /index.html#!/dashboard === /index.html
If you don’t like the hash routing, you can set it to use path with the following:
dmx.routing.router = 'path';
Using path for routing can give some issues when page is getting reloaded and when there is no default document. When you go to http://localhost:63441/ it is possible that you get a 404 instead of the index.html.
When using the hash router window.location.pathname will not work. you can use the following code:
The / route should not load the ./index.html, the Url points to the content page and is loaded within the dmx-view component. Loading the index.html will result in an infinite loop of loading itself.
Your index.html is your main page. On that page you use the dmx-view component that loads partial pages (content pages). The routes point to the pages that will be loaded into the view component. When you have a route to index.html it will result in an infinite loop. The routes should only point to the partial pages that you want to load in the view component.
Got it Teodor, I tried the both ways, and both are failing (Opened a bug report)
There’s a way I can set / to a main page in mobile?
My page starts on index.html, if I go to about.html,
I cant go to the main page (even with a content page on it)