Prevent Tab from being closed

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Prevent Tab from being closed

Post by PointsWell »

On a kinda similar vein to Removing cancel button from forms does anyone know how to remove the close cross from a tab?

I have a process which creates a placeholder BO, opens a tab and then displays the placeholder in a new tab.

I would like to run a process to clean up that placeholder when the tab closes, but you can't run a process on closing a tab, so the next best alternative would be to prevent the user from closing the tab with the close cross on the tab to force them to use an operation button to clean up and then close the tab, but there is no flag to hide the close cross, so I'm guessing a script is required.

Does anyone know how to:
  1. Run a process on tab close, or
  2. Hide the close cross from a tab
hpl123
Posts: 2579
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Prevent Tab from being closed

Post by hpl123 »

I don´t have the whole solutions for you but both can be done. The process when closing tab can be done if you attach an JS event listener to it so when the cross is clicked, the process is executed. The hide cross can be done via CSS. The problem with both hacks is, how can you target 1 cross and not all crosses in the app. You can possibly find a unique selector for the cross so you target only that particular one and then you can use both of the solutions above.
Henrik (V8 Developer Ed. - Windows)
Post Reply