About the behavior of "URLSearchParams"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks 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
3 weeks 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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Both will result in an error if used in a catalog client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
what's your actual business requirement?
Why would you want to see portal within native?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The idea is to create records on the catalog item screen on the portal screen,
and then view the records created on the platform screen from a list.
We considered implementing everything on the portal, but currently we plan to use both the portal and the platform.
For that reason, we came up with the idea of ​​pasting the portal URL into the module and displaying it in the content frame.

