- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2020 10:51 PM
Hi ,
I am trying to close the current UI page through client script but unable to close it . Please help.
Client script Code :
function onSubmit() {
var close = confirm("Thank You for your response. Please click on 'OK' to close the page");
if (close) {
window.top.close();
}
}
Regards,
Sagaya .
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 07:31 AM
this won't work and is not possible.
Scripts may close only the windows that were opened by it." If your script did not initiate opening the window (with something like window. open), then the script in that window is not allowed to close it. Its a security to prevent a website taking control of your browser and closing windows.
check this link
window.close() doesn't work - Scripts may close only the windows that were opened by it
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-13-2020 04:07 AM
Hello,
Where you calling/used the UI page? It should work a expected.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 07:31 AM
this won't work and is not possible.
Scripts may close only the windows that were opened by it." If your script did not initiate opening the window (with something like window. open), then the script in that window is not allowed to close it. Its a security to prevent a website taking control of your browser and closing windows.
check this link
window.close() doesn't work - Scripts may close only the windows that were opened by it
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader