How to get instance URL in UI Action client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2019 08:26 PM
Hi experts:
I am writing script in UI Action client script.
I want the URL domain in my script.
I have tried "window.location.host", but browser displayed "Cannot read property 'location' of null".
However, if I enter "window.location.host" in browser console, this command works.
Anyone could help?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2023 07:29 PM
Well, I sure wish I knew what * this * referred to, so I could best utilize all it's magical properties...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The answer suggesting to use "this.location.origin" didn't work for me in 2025, so I had to use this instead:
g_GlideUI.topWindow.location.originThe g_GlideUI.topWindow should get you access to the "window" and all its tasty goodness that SN has munged to prevent us from doing so... 😉
