what is the difference between window.open and g_navigation.open.
						
					
					
				
			
		
	
			
	
	
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2025 05:12 AM
While developing a UI Action intended to redirect users to an external site, we initially implemented the redirection using the window.open() method. This approach had worked successfully in our previous developments. However, during today's implementation, we observed that window.open() did not function as expected.
To resolve the issue, we replaced it with g_form.navigation.open(), which worked correctly and redirected the user as intended.
We would like to understand the difference between these two methods—window.open() and g_form.navigation.open()—particularly in the context of ServiceNow. Additionally, we are keen to know what might have changed or what configuration we could be missing that caused window.open() to stop working in this instance.
Your insights or guidance on this would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2025 05:17 AM
Hi @ManisaiP ,
Window.open() is the native browser function used in traditional client-side JavaScript to launch external URLs or open new tabs. In ServiceNow scoped applications or modern UI contexts, the native window.open() method often blocked due to global scripting restrictions, whereas the platform supported g_navigation.open(url, '_blank') (or g_navigation.openPopup(url)) reliably opens URLs in the same or new browser tab. I can prefer you to use this approach for UI Actions and client-side navigation.
If you find this helpful, please accept this as a solution and hit the helpful button..
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2025 05:24 AM
g_navigation API provided by ServiceNow in their library and ServiceNow specific.
window.open() is native javascript supported by browser for opening url in new/same tab
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
08-06-2025 05:30 AM
I would like to seek clarification regarding the behavior of the window.open() method in ServiceNow.
In our previous implementations, we successfully used window.open() within UI Actions to redirect users to external sites. However, in our current development, the same method does not appear to be functioning as expected. Interestingly, when we replaced it with g_form.navigation.open(), the redirection worked correctly.This raises a question: if window.open() is being blocked or restricted, how were our earlier implementations able to execute it successfully? We would appreciate your insights into what might have changed or what configuration we could be missing that is causing this discrepancy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2025 05:28 AM
I would like to seek clarification regarding the behavior of the window.open() method in ServiceNow.
In our previous implementations, we successfully used window.open() within UI Actions to redirect users to external sites. However, in our current development, the same method does not appear to be functioning as expected. Interestingly, when we replaced it with g_form.navigation.open(), the redirection worked correctly.
This raises a question: if window.open() is being blocked or restricted, how were our earlier implementations able to execute it successfully? We would appreciate your insights into what might have changed or what configuration we could be missing that is causing this discrepancy.
