About the behavior of "URLSearchParams"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
I'm developing a portal screen that I intend to display in the platform's content frame.
I tried to get the URL using "var urlParams = new URLSearchParams(decodeURIComponent(top.location.search));" in the catalog client script, but nothing was retrieved.
The portal screen works fine if I display it in a separate tab instead of the content frame.
Is there any difference in behavior?
<Example of displaying a portal screen in the platform content frame>
<Normal portal screen>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
To get the ServiceNow platform URL from a content frame (iFrame), you need to access the top-level window from within the frame. This is necessary because the content frame is often inside nav_to.do, which hides the base instance URL
// Get the base URL (e.g., https://instance.service-now.com)
var platformURL = window.top.location.origin;
// Alternative to get full URL including relative path
var fullUrl = window.top.location.href;
// or just
var URL = window.top.location;
Are you trying Catalog Client script?
