How to close xpages in notes client? I use CSJS wi

2020-03-28 22:07发布

问题:

I'm doing an xpinc application.

I followed the example in here and modified it. Currently the close button is on my main page.

The customer wanted a close button instead of the normal 'X' to close. But the example suggests that I should create 2 xpages.

On page1 I should create a button with window.open(xpage2.xsp) and only then window.close() in a button in xpage2 will work. How do I window.close() when I have no window.open() to begin with?

I've check Demo Discussion xpage and OneUI but there's nothing like that. I tried putting window.open(xpage1.xsp) on xpage1 onClientLoad event but that's not working too.

回答1:

Only if the page is opened by window.open, then window.close works fine. otherwise it does not work. Please see the following question, same question has already appeared in stackoverflow.

How to close the xpages?

For my project, I redirected the page into my home page.

And I am also searching the fine solution for this problem.



回答2:

I had the same problem today and found this very interesting article by Fredrik Norling, which helped: http://www.xpagedeveloper.com/2013/ibm-notes-domino-9-01-xpages-fixlist

There is a new notes.ini (client) parameter:

XPagesXulAllowScriptsToCloseWindows=1

together with the SSJS code

view.postScript("window.close()");

worked for me - the tab / window in the Notes Client could be closed from the XPage.

Strange thing that we have to add this parameter, maybe it has something to do with security...