web app return window by HandleSpecialURL

hello,
if me have a web app running as service at port 1024
it is possible to start with a window if me call in browser
domain:1024/special/page1
or
domain:1024/api/page1
?

i mean to start within this event HandleSpecialURL

Sure. Store the HTML content of said page in a constant and print it through Request.print. You can also open a file on the disk and print it’s content through Request.print.

i meant something like this in this event HandleSpecialURL
var w as new Window1
w.Show

[quote=471985:@Markus Rauch]i meant something like this in this event HandleSpecialURL
var w as new Window1
w.Show[/quote]
HandleURL and HandleSpecialURL run outside of a session context, so you’ll have to track the user in some way to present them with a webpage on a session. This may or may not be easy to do within the Xojo framework - I haven’t looked into it.

You may be interested in the WebSession.HashTag property and WebSession.HashTagChanged events. You can achieve a “direct to page” link using the anchor system very easily within the Xojo framework.
https://documentation.xojo.com/api/web/websession.html#websession-hashtag
https://documentation.xojo.com/api/web/websession.html#websession-hashtagChanged

ok thanks, i will try and i think it will fulfill my needs.

btw,
can i start a app via this and read the Get arguments?
domain:1024?argument1=123&argument2=abc

[quote=471989:@Markus Rauch]ok thanks, i will try and i think it will fulfill my needs.

btw,
can i start a app via this and read the Get arguments?
domain:1024?argument1=123&argument2=abc[/quote]

Yes you can and in session.open event you do:


If Self.GetParameter("argument1") = "page1" then
Dim wp As New Webpage1
Self.Currentpage = wp
End if

[quote=472007:@Derk Jochems][/quote]
thank you

seems xojo renamed it to URLParameter

because this HashTagChanged only appear at change i can not use it but i guess i can read this tag at session open

my tests:
with hashtag the session open event only occurs once (and again after the session was closed)
if me use a URLParameter the session open event occurs always.

HashtagChanged requires a session, which is only available in a full fledged Web app session. No session is created in HandleURL.

The best way to go would be to send the visitor to another web site, to an HTML page, or to the app itself, with a URL parameter that tells it to open a particular WebPage (NOT a “Window”).

For instance:

Function HandleURL(Request As WebRequest) Handles HandleURL as Boolean if request.Path <> "" then Request.print(redirect) Return true end if End Function

[code]Public Const redirect as String =

[/code]

You could do this to open a page on your web app. Check the presence of the “openpage” URL parameter value:

[code]Public Const redirect as String =

[/code]