ana.rodrigues Posted October 18, 2023 Share Posted October 18, 2023 Hi, In my webapplication, i use the UniSession.BrowserWindow(lURL 0, 0, '', [bwStatus]), and later on, i want to close it. Is it possible to close a Browser Window called with UniSession? If so, how can i do it? Thanks. Best Regards, Ana Rodrigues Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2023 Share Posted October 18, 2023 Hello, You can use this approach: // open procedure TMainForm.UniButton1Click(Sender: TObject); begin //UniSession.BrowserWindow(...); UniSession.AddJS('if (typeof _win != "undefined") {_win.close()}; _win = window.open("https://example.org")'); end; // close procedure TMainForm.UniButton2Click(Sender: TObject); begin UniSession.AddJS('_win.close()'); end; 1 Quote Link to comment Share on other sites More sharing options...
ana.rodrigues Posted October 18, 2023 Author Share Posted October 18, 2023 3 hours ago, Sherzod said: Hello, You can use this approach: // open procedure TMainForm.UniButton1Click(Sender: TObject); begin //UniSession.BrowserWindow(...); UniSession.AddJS('if (typeof _win != "undefined") {_win.close()}; _win = window.open("https://example.org")'); end; // close procedure TMainForm.UniButton2Click(Sender: TObject); begin UniSession.AddJS('_win.close()'); end; Thank you, It works! 1 Quote Link to comment Share on other sites More sharing options...
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.