- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 01:35 AM
When the following process is executed as a UI action, an Excel file created on 4/16/2025 will be downloaded.
When executed in the Chrome browser, the download tab closes, but for some reason it remains open in Edge...
It doesn't seem like there's an error, but does anyone know the cause?
※When clicked "prb_test();"
function prb_test() {
top.window.open('/problem_list.do?EXCEL&sysparm_fields=number&sysparm_query=sys_created_on=2025-04-16');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 09:22 AM
I don't think it's because of the sysparm_query as it's the same in both the browsers.
It's the way how each browser handles the download
You can verify it in firefox if required.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 01:40 AM
When you run the process in Edge, two tabs will open.
One will close and the other will remain.
When you run the process in Chrome, only one tab will open.
The one open tab will close.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 01:42 AM
it's because how browser handles the window.open method
try this so that it works in edge as well
function prb_test() {
var downloadWindow = top.window.open('/problem_list.do?EXCEL&sysparm_fields=number&sysparm_query=sys_created_on=2025-04-16');
setTimeout(function() {
downloadWindow.close();
}, 3000); // Adjust the delay as needed
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 07:33 AM
Thank you for your answer!
I was also thinking of closing the tab with a timeout!
However, what bothers me the most is that for some reason the tab closes properly when I use the following code...
I'd like to know the cause, not a solution.
function prb_test() {
top.window.open('/problem_list.do?EXCEL&sysparm_fields=number');
}
I think it's because of "&sysparm_query=sys_created_on=2025-04-16", but I don't know why the tab won't close...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 09:22 AM
I don't think it's because of the sysparm_query as it's the same in both the browsers.
It's the way how each browser handles the download
You can verify it in firefox if required.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader