This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 9, 2011, 6:41 AM
13 Posts

8.5.1 and Window.close()

  • Category: Other
  • Platform: Windows
  • Release: 8.5.1
  • Role: Developer
  • Tags: window.close() in 8.5.1
  • Replies: 3

To start with a simple thing on a client xpage build in 8.5.1 I have placed a close button so pressing which client xpage will close.

 

I used window.close in the client javascript which is not working in 8.5.1 and we cannot migrate to 8.5.2 now.

 

Then as a workaround I have used logic say when user press close button on xpage it will redirect to another page and that page I am trying to press esc key progrmatically so the xpage could be closed.This all exercise is to close xpage in 8.5.1 client, web window.close works.

 

 

Also esc key press code is giving me an error saying keyEvent.initKeyboardEvent is not a known function I have used below code in client side javascript of a button on a page.

 

var keyEvent = document.createEvent("KeyboardEvent");

var keyLocation = '0x00';  var keyIdentifier = "Esc"; keyEvent.initKeyboardEvent ("keypress",true,true,window,keyIdentifier,keyLocation,false);

 

 Thanks.

Mar 9, 2011, 10:35 AM
16 Posts
Re: 8.5.1 and Window.close()
In 8.5.1, I have an script block that has the following code in it
 
dojo.addOnLoad( function(){
 dojo.connect( document, 'keydown', function(e){ 
       if(e.keyCode === 27)
       {
 
       window.location.replace(your path to go to);
       };
 }) ;
 
});
 
This works quite nicely when the user presses the escape key in the Notes client
Mar 10, 2011, 4:52 AM
13 Posts
Re: 8.5.1 and Window.close()
Thanks Mike,
 
Actually I was looking out for simulating esc key press programatically so page will close automatically on launch,so piece of code in dojo,dijit or modification in the one I provided(but its not working as expected)  is what i am trying for. 
Mar 10, 2011, 5:52 PM
64 Posts
You want the page to close on launch?
- If so then close it in onLoad.  (grin)  ESC processing isn't required.
 
- If you want ESC processing in your window then Mike's suggestion should be the ticket.

- If you want ESC processing in some particular place then Mike's suggestion is still the ticket.  The difference is the dojo.connect should be applied to whatever DOM element you want the ESC processing on.  For instance, I have similar code that attaches an event handler to a dijit underlay, so ESC will dismiss the current dialog.  Works a treat.
 
EDIT: I see now this is a repost of a prior question where you want window.close to close the MAIN window.  You can't.  This has not one thing to do with XPages, any version.  It's a browser issue.  You can close dependent pop-up windows all day with window.close(), but it's impossible to FORCE the main window to close.  Only the user can do that.
 
Hope this helps...

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal