<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Detecting when the user closes the window or tab of the browser in a Html Dialog</title><link>https://answers.axonivy.com/questions/2406/detecting-when-the-user-closes-the-window-or-tab-of-the-browser-in-a-html-dialog</link><description>&lt;p&gt;Hello! I have the following scenario:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;User goes to the their Personal Task List;&lt;/li&gt;
&lt;li&gt;There's 1 task;&lt;/li&gt;
&lt;li&gt;User closes the window or tab in the browser;&lt;/li&gt;
&lt;li&gt;User comes back in 5 minutes and goes to their Personal Task List;&lt;/li&gt;
&lt;li&gt;The task is gone;&lt;/li&gt;
&lt;li&gt;After 30 minutes, the user refreshes the page;&lt;/li&gt;
&lt;li&gt;The task is back;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Question 1.&lt;/strong&gt;
I understand that since the user started to work on that task (step 2), it changed from SUSPENDED to RUNNING, and other users are not able to see that task in the meantime. I don't understand why even the user that is working on that task, can't see the task in the Personal Task List.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question 2.&lt;/strong&gt;
Using Html Dialog, How to detect when the user change the context on the browser, to bind it to an event in the Logic? For example, if the user closes the tab/window, then it would fire a process to change the task to SUSPENDED again.&lt;/p&gt;
&lt;p&gt;I found old answers but they don't seem to be the exact scenario:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://answers.axonivy.com/questions/434/hook-into-global-closing-with-x-on-the-window"&gt;Hook into global closing with "X" on the window&lt;/a&gt; - It talks about Rich Dialog and Java Class, I am using Html Dialog and I would like to bind it to an event containing a Script Step with a code in Ivy Script;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://answers.axonivy.com/questions/359/how-can-i-logoff-the-user-if-he-closes-the-browser"&gt;How can I logoff the user if he closes the browser?&lt;/a&gt; - This one says that the task would be immediately available for the same user, but this is not what's happening in my scenario.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2406/detecting-when-the-user-closes-the-window-or-tab-of-the-browser-in-a-html-dialog" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 31 Jan 2017 14:46:40 -0500</lastBuildDate><item><title>Answer by SupportIvyTeam</title><link>https://answers.axonivy.com/questions/2406/detecting-when-the-user-closes-the-window-or-tab-of-the-browser-in-a-html-dialog/2407</link><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Question 1:
This depends how the Workflow UI your using is implemented (e.g. the Portal delivered with 6.5.0 still shows the Task in the Task list and asks if it should reset it when opening it again)&lt;/p&gt;
&lt;p&gt;Question 2:
You could do this using JavaScript and the &lt;a href="https://stackoverflow.com/questions/3888902/javascript-detect-browser-close-tab-close-browser"&gt;beforeunload&lt;/a&gt; event and then call a process which resets the current task. Or you could use the Portal or look at how the Portal implemented it.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SupportIvyTeam</dc:creator><pubDate>Tue, 31 Jan 2017 14:46:40 -0500</pubDate><guid>https://answers.axonivy.com/questions/2406/detecting-when-the-user-closes-the-window-or-tab-of-the-browser-in-a-html-dialog/2407</guid></item></channel></rss>