Need help with navigation (also where to host and how)

Added by Jerry Z 3 months ago

I'm a software developer coming from Qt over to Wt. I do have some experience with web development, but I'm not that well versed in it.

The issue I'm having is I don't have clear understanding of navigation with Wt (particularly when the path changes). Below are some cases I'm trying to do:

case A) I have 2 apps setup with WServer with one as default (localhost/) and the other at localhost/a/. Following a button event in the first I want to navigate to /a/ without using the full address.
case B) The second is similar to the hangman example, but I want to navigate to them and not just have the address change. So I want the app to have a /x/ and a /y/ sub path where depending on which one it is, different things are shown.

If someone can point me to the proper calls or write a simple demo of that. I'd greatly appreciate that.


Replies (1)

RE: Need help with navigation (also where to host and how) - Added by Koen Deforche 3 months ago

Hey Jerry,

A) For this you need to let the user follow an anchor (e.g. WAnchor) with ref="/a". This is a host-relative path.
B) For this you need to let the user follow an anchor with an "internal path change". This is a Wt-specific thing (it's based on HTML5 History API). You do that with a WAnchor on which you set a WLink(WLink::InternalPath, "/y").

Internal paths keep the same session, and create events within. Normal anchors (that end up in a Wt application) will create a new session.

Regards,
koen

(1-1/1)