"Close the browser window" form rule action redirects to about:blank instead of closing the window.

  • 14 April 2016
  • 1 reply
  • 13 views

Userlevel 3
Badge +10


 

Symptoms

 


"Close the browser window" form rule action redirects to about:blank instead of closing the window.
 

 

Diagnoses

 


HTML 5 standards dictate that windows that have not been opened by a script cannot be closed by that script: https://www.w3.org/TR/html51/browsers.html#dom-window-close

Here's a community post regarding this issue: http://community.k2.com/t5/K2-blackpearl/Rule-quot-close-the-browser-window-quot-with-different-results/m-p/63350#M17734
 

 

Resolution

Create a Literal, Hidden Data Label on your form, and when you wish to close the window, create a Transfer Data rule that transfers the following script into the Data Label:

<script>window.open('', '_self', ''); window.close();</script>

This script opens a blank window on the current page and then closes it, getting around the aforementioned issue.

 

 



 

1 reply

Badge +2

This doesn't appear to work if the page is still in the workspace.

Reply