Close browser tab when button is clicked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 06:07 AM
Hello everyone!
I have a form button called 'Close'. My requirement is as follows: When the button is clicked, the browser tab should be closed. What scripting should be done for this in the UI Action, can anyone help me with this please?
Thanks in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 06:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 07:29 AM
Hi!
I used the following code in the UI Action script:
GlideDialogWindow.get().destroy();
it redirected me to the previous page in the same tab. How should I simply close that tab?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 06:13 AM
Hi,
please use client side UI action
OnClick: closeWindow();
this script should work fine
Script:
function closeWindow(){
window.open('','_self').close();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 06:19 AM
Hello Ankur,
Thanks for the response! Can you please tell me what is written after open in this line : window.open('','_self').close();