- 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 09:56 AM
Hi Midhun,
ServiceNow has stopped few things in scoped app such as window html object, DOM manipulation etc.
Scoped Applications and Client Scripts: A Primer
Regards
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:00 PM
Just remember, if your app is dependent on a custom globally scoped object
- It won't be part of your app
- Will need to be created in another update set
- Your app can't be certified
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2017 09:26 PM
Hi Vineeth,
Please find the below link
Re: Scoped Application: How to open URLs in a new tab/window?
PS: Hit like, Helpful or Correct depending on the impact of the response
Thanks
Chandu Telu