How to delete cookie by clicking Sign Out button in VLF Version 13.

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
JABIVULLAS
Posts: 12
Joined: Tue Sep 19, 2017 6:07 pm

How to delete cookie by clicking Sign Out button in VLF Version 13.

Post by JABIVULLAS » Wed Sep 25, 2019 11:49 pm

Hi ,

We are using VLF version 13(VL Rich Client). We have embedded a new independent application by configuring its url name in the properties tab of a business object. Now the question is how do i delete cookie when clicking SIGN OUT button. Is there a way to achieve this. Please see to the attached screen shot.

JABIVULLAS
Posts: 12
Joined: Tue Sep 19, 2017 6:07 pm

Re: How to delete cookie by clicking Sign Out button in VLF Version 13.

Post by JABIVULLAS » Wed Sep 25, 2019 11:51 pm

Please refer to the attached screen shot.
Attachments
sign_out_vlf13.JPG
sign_out_vlf13.JPG (67.96 KiB) Viewed 1056 times

LANSAGuru
Posts: 68
Joined: Thu Mar 24, 2016 5:31 am

Re: How to delete cookie by clicking Sign Out button in VLF Version 13.

Post by LANSAGuru » Thu Sep 26, 2019 12:23 am

#1 What is the actual url?

#2 You are going to have to send a signal to the web page and then probably run some javascript to delete the cookies. Sending a signal to the web page will not be that simple....if you are using VL Web you can use local storage to monitor for the message on the other side (the currently opened website) and then on change from the other side you can delete the cookie. I have a mental picture in my mind how this would work. There are some examples of signalling in the shipped examples I think using local storage to communicate between 2 browser windows. You would want to run a seperate url when you click sign out, then that window would signal the other opened browser window in a sideways manner. It could all be done inside LANSA if this is VL Web urls. If not, you would have to write some javascript to do this.

#3 There is the IE activeX control, but I don't think you want to go down the road...it is pretty complicated. When you use the web control from within VL Windows, you are actually running the IE browser control.

Lets get some more details on the url and what kind of application you are running. For instance, is it a LANSA web url or not.

There might be some other ways, this is what I can think of at the moment...

Paul


JABIVULLAS
Posts: 12
Joined: Tue Sep 19, 2017 6:07 pm

Re: How to delete cookie by clicking Sign Out button in VLF Version 13.

Post by JABIVULLAS » Thu Sep 26, 2019 7:11 pm

Hi,

Thanks for your reply. Below is our Web url

http://10.110.4.100:41/images/irfs/LSSA ... G_BASE.HTM.

After we login there is a sign out button on the top right corner. We have embedded two independent applications in our LANSA vlf (ver 13) and wanted to delete cookies that are set for those applications while clicking SIGN OUT button. Please refer to the attached screen shot(encircled sign out button in red).

Please advise how to delete cookies when sign out button is clicked. Appreciate your prompt reply.
Attachments
LD_Web_Signout.png
LD_Web_Signout.png (566.48 KiB) Viewed 1032 times

JABIVULLAS
Posts: 12
Joined: Tue Sep 19, 2017 6:07 pm

Re: How to delete cookie by clicking Sign Out button in VLF Version 13.

Post by JABIVULLAS » Thu Sep 26, 2019 7:55 pm

Hi Mark,

Thanks for your reply.

Is this related - https://developer.mozilla.org/en-US/doc ... -Site-Data

Above is your reply. Please let us know where we need to incorporate this piece of code i mean which file or what location.

LANSAGuru
Posts: 68
Joined: Thu Mar 24, 2016 5:31 am

Re: How to delete cookie by clicking Sign Out button in VLF Version 13.

Post by LANSAGuru » Fri Sep 27, 2019 12:21 am

#1 It appears the VLF Win part is not relevant from what I can tell...the screen shot shows a web browser running stand alone. Even if it is inside the Win VLF container (VLF inside VLF) which you don't show, that might just be confusing the issue. What you are showing is just a VLF Web with and exit button.

#2 You are going to need to write a widget. The widget will need single method called mDeleteCookies. You can look at some of the sample widgets to get an idea how to do that...it is not that complicated. You will need to find someone with at least SOME javascript skills.

#3 The widget JavaScript code will need to do something like this.

function getCookie(NameOfCookie)
{
if (document.cookie.length > 0)
{
begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1)
{
begin += NameOfCookie.length+1;
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end));
}
}
return null;
}

function setCookie(NameOfCookie, value, expiredays)
{
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) +
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function delCookie (NameOfCookie)
{
if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

#4 I would suggest you drop outside of your application, write a simple web page which sets and deletes cookies until you have that working using your new widget. Once you have that, then post the code here - GIVE BACK TO THE COMMUNITY.

#5 Once you have the cookie part you need to add some code to the VLF to capture the sign out event...there is something in the FrameWork I think to capture when you try to leave and do a confirm or something...that is where you would put this remove cookie code.

#6 This is not the greatest code in the world, there might be easier code somewhere....do some googling for the JavaScript stuff and you will find many examples

Good Luck.

Paul

LANSAGuru
Posts: 68
Joined: Thu Mar 24, 2016 5:31 am

Re: How to delete cookie by clicking Sign Out button in VLF Version 13.

Post by LANSAGuru » Fri Sep 27, 2019 12:25 am

If it is possible to change your applications which use cookies, you might want to consider using local storage instead. This can be accessed directly from your VL Web application and the VLF Web as well...so no widget and no JavaScript required.

https://docs.lansa.com/14/en/lansa017/c ... 1_0295.htm

Paul

Post Reply