Timeout of windows spawned using window.open

I use the window.open javascript command in several of my ZEN applications. I would like the window spawned by window.open to timeout when the original window, that spawned the secondary window, times out. Thank you for all input.

  • 0
  • 0
  • 56
  • 1
  • 1

Answers

Hi.

You could do that with the following way

1. Define your own custom event class (inherit from %CSp.SessionEvents)  then you may interact with the session creation/deletion:
2. In OnStartSession() callback in the event class, you may store the sessionId in your own global/table.
3. In OnEndSession() callback in the event class you may delete/kill your own data.
4. Pass the SessionId from the parrent window to the child (if you do not have it there already)
5. Have a timeout JS code to call the server using #server or #call every x sec. with a check of your own global/table for this SessionId.
If not exist - preform a "windowsClose" or a in-window message...

 

Here is more documentation abourt it :

https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCSP_sessions