mos Posted October 4, 2017 Posted October 4, 2017 When a user clicks a button to exit my uniGUI application it currently displays a page: "Web Session Terminated" with a hyperlink to Restart Application. Instead of the above occurring I would like the browser tab/window to close rather than display the above. What changes do I need to make to force my application to close it's own browser tab/window when exiting? Quote
Hayri ASLAN Posted October 4, 2017 Posted October 4, 2017 Ordinary javascript cannot close windows willy-nilly. This is a security feature, introduced a while ago, to stop various malicious exploits and annoyances. This means, with one small exception, javascript must not be allowed to close a window that was not opened by that same javascript. You can use UniApplication.Restart or servermodule.options.soRestartSessionOnTimeout = True Quote
mos Posted October 4, 2017 Author Posted October 4, 2017 Hi Hayri, Thanks for your reply. My application is actually launched from within another uniGUI application via javascript and so once a user has finished with my application I need to be able to close my tab/window. In my situation would I be able to use javascript to close my tab/window when someone clicks on the exit button in my application and if so where would I need to put this javascript so it can be executed? Quote
Hayri ASLAN Posted October 5, 2017 Posted October 5, 2017 Hi unisession.addjs('window.close();') Quote
mos Posted October 9, 2017 Author Posted October 9, 2017 Hi Haryir, Can you tell me how this JS would actually get called? I have a button on the mainform which the user clicks to exit my application and the onclick event handled just calls Close;. Quote
mos Posted October 10, 2017 Author Posted October 10, 2017 Hi Haryri, I have actually worked out what I needed to do. All I had to do was replace the Close; call with the JS and my application now closes. Thanks for all your help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.