Jump to content

How can I close a Browser Windows?


Davide Vaccaro

Recommended Posts

HI Everybody

i open a new Browser Page with the following coomand (from the website):

  UniSession.BrowserWindow('news/news.dll', 1280,1024, '_blank' );

and so i start a new UniGui Application in Form Mode, it work super but when i let the user quit the application with a Form.Close the result is an empty new Browser Windows (blue screen with the "Restart Application" line....

How can i close this Browser Windows?

Thanks for any help.

Davide

Link to comment
Share on other sites

Hello,

I use this code to open new window tab

UniSession.AddJS('let printWindow;'
        + ' function OpenNewTab() {'
        + ' printWindow = window.open(''news/news.dll'', ''1280'',''1024'');'

        //onready do some stuff
        + ' ready(function(){'
        //Show Print Dialog
        //+ '   printWindow.print();'
        + ' });'
        //Close the new browser tab after 5 seconds
        //+ ' setTimeout(closeWin, 5000);'
        + '};'
        //wait to ready state
        + ' function ready(callback){'
        // in case the document is already rendered
//        + '     if (printWindow.document.readyState!=''loading'') callback();'
        + '     if (printWindow.document.readyState == 4 && printWindow.document.status == 200) callback();'
        // modern browsers
        + '     else if (printWindow.document.addEventListener) printWindow.document.addEventListener(''DOMContentLoaded'', callback);'
        // IE <= 8
        + '     else printWindow.document.attachEvent(''onreadystatechange'', function(){'
//        + '         if (printWindow.document.readyState==''complete'') callback();'
        + '         if (printWindow.document.readyState == 4 && printWindow.document.status == 200) callback();'
        + '     });'
        + ' }'

        //Close the new browser tab
        + 'function closeWin() {'
        + '  printWindow.close();'
        + '};'

        //Start new window Tab
        + ' OpenNewTab(); '
        );
 

Link to comment
Share on other sites

Hi irigsoft, thanks for the quick hint

in my case we have a app.dll as caller and a news.dll as called app with " UniSession.BrowserWindow('news/news.dll', 1280,1024, '_blank' ); "

news.dll start in a separate Browser session... is that equivalent to a new TAB? Sorry in UniGui i am a newbie so maybe my doubt are out of place.

Link to comment
Share on other sites

1 hour ago, Davide Vaccaro said:

Hi irigsoft, thanks for the quick hint

in my case we have a app.dll as caller and a news.dll as called app with " UniSession.BrowserWindow('news/news.dll', 1280,1024, '_blank' ); "

news.dll start in a separate Browser session... is that equivalent to a new TAB? Sorry in UniGui i am a newbie so maybe my doubt are out of place.

Sorry, my mistake, I meant "new browser page"

Link to comment
Share on other sites

Ok i try it and i learned a lot of things....but now i understand what Sherzod mean with Where do you want to close the new tab from?

I want to close the new browser Form inside the new browser form (news.dll) like the user click the borderIcon 'X' on the top/right of the form.

Irigsoft, thanks again, you showed me how important is to master JavaScript.....im am an old delphi-man.

I tried with soTerminateOnSession in the ServerModule with no success.....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...