NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: springguy on April 11, 2012, 03:24:01 AM
-
I have an HTML page with embedded NetTalk components. On the HTML page, I have an HTML button with a link to another HTML page. What I would like to do is to allow that link to be dynamically selected based on NetTalk session values. In other words, based on a GSV variable, to link to one of some number of links.
I assume this will require some JavaScript added to the HTML page, but how would it have access to the NetTalk session variables?
Thoughts?
Mike Springer
-
at what point do you know what the URL should be? When the page is displayed to the user?
Or at some point afterwards, when the user has been interacting with the page for a while?
cheers
Bruce
-
Bruce,
Programatically, I would know the potential URLs when the page is displayed. But, I don't know which one is the appropriate one without looking at a session value, then upon testing the session value, I would select which URL would be the right one to call.
Mike
-
there are two approaches you can take here.
a) have the URL pre-prepared in a SessionValue. Then use the session value on the web page. For example;
<a href="<!-- Net:s:url -->">whatever</a>
This method is very clean, but pre-supposes you can have the URL session value preloaded.
Another approach is to create a NetWebSource procedure that just returns the value. The key here is to be careful that it doesn't return anything else, so you need to inspect the source for a netwebsource, and make sure it only returns the URL. Then, assuming the procedure is called say fred, your html looks like this;
<a href="<!-- Net:fred -->">whatever</a>
Cheers
Bruce
-
Bruce,
I am particularly interested in using the netwebsource approach you mentioned. What I don't understand is how the return from the netwebsource works to direct the call to the desired url.
In other words, in the static page link I have:
<a href="!<-- Net:MyWebSource -->">Click Here to Go To The Right Place</a>
In MyWebSource procedure, I have the following code:
If p_web.GSV('MyDirectingVariable') = 'Y'
! I want to specify the url that is appropriate here
Else
! I want to specify some other url here
End
Your previous post simply said the source procedure returns the desired URL, but I don't understand (as you can see in my example above) how you return the url to call the desired page.
Mike
-
If p_web.GSV('MyDirectingVariable') = 'Y'
! I want to specify the url that is appropriate here
packet = 'http://www.capesoft.com'
Else
! I want to specify some other url here
packet = 'http://www.clarionshop.com'
End
do SendPacket
-
Thanks Bruce - worked perfectly!
Mike