Using HTML Link To Communicate With Xojo Web App

Hey there,

Is it possible to use a link or Javascript as a ‘link’ to communicate with my web app using the PageSource control.
For example:

<a href="xojoapp:Method1"</a>

Thanks

Closest thing would be using the href tag to change the hashtag then detecting that and doing something.

You could use a query string and parse it:

<a href="xojoapp?Method1"</a>

[quote=62309:@Carl Hogue]You could use a query string and parse it:

<a href="xojoapp?Method1"</a>

Thanks how is this done?

Dim Session as Session = Session // Thom once said that if Session is to be called multiple times this will speed it up.

  If Session.URLParameterExists("test") Then
    MsgBox Session.URLParameter("test")
  End If

Example:

<a href="xojoapp.cgi?test=hello%20world"</a> // < cgi

You really should write that more sensibly like

  Dim aSession as Session = Session

I’ve seen this style in a few places & quite honestly it can cause you problems (fortunately not very often but when it does you’re really puzzled) and makes for hard to trace & hard to read code and some odd bugs.

To illustrate one of the issues

     Dim Session as Session = Session
     call Session // this won't compile despite there being a "Session" method - the local hides it

or

  dim session as Session = Session
  
  if Session(Session) = session then
    // is this if cast(local) = local ?
    // or a cast(function call) = function call ?
   // or a potential subscript operation on the session local variable?
   // or what ???????
  end if

Later in your code you have to read in detail and knowing how the compiler resolves the names to be sure if Session is a local, a method or a type and it ail entirely depend on the usage.

You can’t just “read the code” and know from usage

Why do that to yourself ?
So don’t :stuck_out_tongue:

Thanx Norman!
You learn something every day :slight_smile:

[quote=62339:@Albin Kiland][code]
Dim Session as Session = Session // Thom once said that if Session is to be called multiple times this will speed it up.

If Session.URLParameterExists(“test”) Then
MsgBox Session.URLParameter(“test”)
End If
[/code]

Example:

<a href="xojoapp.cgi?test=hello%20world"</a> // < cgi [/quote]
Thanks all.

[quote=62429:@Albin Kiland]Thanx Norman!
You learn something every day :)[/quote]
I had to ask Joe (the compiler guy) how that one would resolve & HE had to guess (then go look at the code)
If HE can’t tell me off the top of your head then its probably not a good idea to do it :slight_smile:

What event handler should I be using and what code for hashtag links? Thanks

In HTML, hash tag links # are meant to position the page at a given scroll position. What do you want to obtain ?