Hi folks,

My webpage has many tabs. One tab is running my formspider application. There are many things I like to do before the user closes formspider application. One is to record a log of user activity like when opened/closed the application etc. Is there a mechanism to capture the webpage closed event?



asked 24 Feb '13, 23:43

George's gravatar image

accept rate: 0%

edited 25 Feb '13, 12:05

oskansavli's gravatar image

oskansavli ♦♦

Hi George,

You can use "Close" event of the application to achieve your request (you can find this event under the "Events" tab existing in the application edit dialog).

Note that once this event is defined, you have to close the application using the api_application.close API in the procedure called on this event.

procedure closeApplication is

Best Regards,


answered 25 Feb '13, 04:38

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
accept rate: 25%

Hi Ibrahim,

Thank you.

Unfortunately this procedure is not firing either when the application running tab is closed or when the webpage as a whole is closed. However, if I invoke the same procedure using a button the close procedure is executed.

Can you suggest me how to solve this issue? Or is it a bug?



(25 Feb '13, 07:02) George

How did you tested this? If you are trying to show popup to user on close event, it wouldn't work when browser tab is closed. You can only run db related actions such as logging because it is not possible to prevent closing of browser tab.

(25 Feb '13, 07:38) oskansavli ♦♦

Hi, I have seen popups with the message, 'stay on page or continue and exit' when you try the close a page. Therefore I tried to put a popup on close. But as you told it does not work. But I tried to write to table and the same is worked.

But just as I told above I also like to give a warning message to the user when he is closing.

Thank you for your answer.


(25 Feb '13, 08:04) George

You can use "Application Unload Message" under "Edit Application --> Browser Settings" to always notify user before close. To only notify when something is changed, you can set this on runtime by using api_application.setBrowserMessage().

(25 Feb '13, 08:22) oskansavli ♦♦

I tried api_application.setBrowserMessage() but unfortunately this is also not working. Thank you any way. Do you have any other work around?

(25 Feb '13, 13:32) George

How do you apply it? I put the code in my close procedure. Popup message is working when closing the application through close button. But with setBrowserMessage no message is displayed.

(25 Feb '13, 13:37) George

It is not an api that shows a popup to user immediately, instead it just sets the message that user will be notified before exit.
You should call setBrowserMessage when user changes something; not on close event. If user closes browser, your action's response does not even reach to user. So you should set browser message on some other action, like when user changes something. Or you can set it initially on application settings, this way it always alerts user before exit.

(25 Feb '13, 14:00) oskansavli ♦♦
showing 5 of 7 show 2 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 24 Feb '13, 23:43

Seen: 1,677 times

Last updated: 25 Feb '13, 14:04

Related questions

© Copyright Gerger 2017