Page 1 of 1

Close Current Tab

Posted: Wed Dec 03, 2014 7:37 pm
by AjFromADS
Is there a way to close the current tab by clicking a button, without having the "Your session has ended." message show up?

Re: Close Current Tab

Posted: Thu Dec 04, 2014 11:11 am
by Scott Klement
Is this an Atrium tab? When I try to close an Atrium tab (by ending the program), I do not get the 'your session has ended' box, it seems to just close the tab.

Or, what type of tab do you mean?

Re: Close Current Tab

Posted: Thu Dec 04, 2014 3:08 pm
by AjFromADS
I believe it is an Atrium tab. We call the program using a URL. I want to be able to press a button the will close the browser tab that the program is running in.

Re: Close Current Tab

Posted: Thu Dec 04, 2014 5:32 pm
by Scott Klement
It's not clear to me if you're using an Atrium tab or a browser tab, you mentioned both in your last reply. You said you think you're using Atrium... if so, when you set up the menu item (in Atrium's control panel, on the Navigation pane) then you should have properties like this:
atriumtab.png
atriumtab.png (9.75 KiB) Viewed 666 times
The "Open as" property will determine whether you open the application as a "tab in the portal" (aka Atrium tab) or a new browser window/tab. So if you're using Atrium, then looking at these properties should tell you what sort of tab it is.

You also mention that you're running the application via a URL. Obviously (as you can see in the above screenshot) this is possible in Atrium, but it's also possible to launch a URL in a variety of other ways, such as JavaScript, or buttons/links, or even something like STRPCCMD from green-screens. In those cases, you are surely getting a browser tab because Atrium isn't being used.

So... hopefully with that info, you can determine if this is an Atrium tab or browser tab.

If this is an Atrium tab... then you are likely either launching the item as a "Rich Display", "Web Application" or "Genie Macro". For Rich Display or Web Application the tab should automaticalyl close when the program ends. If that isn't working, please contact our support department. If this is a Genie Macro, then you should have an instruction that says "Close the browser window or tab" when a particular screen is reached, and this should close things properly.

If this is a browser tab, then there are variables that can be used to control what happens when the session is closed:
http://www.profoundlogic.com/docs/displ ... n+on+Close

There's also a pui.closeSession() API as well:
http://www.profoundlogic.com/docs/displ ... sion%28%29

Also note that sometimes a browser won't let you close a tab programmatically. (I think this is a security thing.) This is a feature of the browser that we do not have control over, so when that happens, PUI will display a message asking the user to close the tab...