- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2017 07:57 AM
I want to get current url of the browser in my application, but I see that window.location.href is not working in scope application.. I tried it in both my application scope and global scope catalog items, its working fine in global scope but in my application scope it is not working.
var url = window.location.href;
alert(url);
do we have any alternative for fetching url which works ni scope applications ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2017 09:24 AM
Hi Vineeth,
window object doesn't work in scoped app. Here is an alternative.
1) Create ui script in global scope and have function in that which will return window.location
2) call this ui script function from your client side in your scoped app.
It should work
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2017 08:04 AM
Hi Vineeth,
Could you try using
var url = this.location.href;
alert(url);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2017 08:14 AM
this is also not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2017 09:24 AM
Hi Vineeth,
window object doesn't work in scoped app. Here is an alternative.
1) Create ui script in global scope and have function in that which will return window.location
2) call this ui script function from your client side in your scoped app.
It should work
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2017 09:32 AM
Hi Ankur,
What is the reason for - window object doesn't work in scoped app. Here is an alternative.
what is the scope of "window" ??