- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2016 07:51 AM
Hi: We have the following script in our 'Resolve Now' UI action that is called every time the user clicks the 'Resolve Now' button:
if (typeof window == 'undefined') {
serverResolve();
}
I am wondering if something is wrong with the code. What is window == 'undefined'? Is it always 'undefined'? When is it 'defined'?
Thanks for your help!
Rita
Solved! Go to Solution.
- 29,321 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2016 05:39 AM
Hi Rita,
if(typeof window == 'undefined') means
1.Code that runs without 'onclick'.
2.Ensure call to server-side function with no browser errors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2025 12:25 PM
if we write
var name = "servicenow"
gs.print(typeof name ) , It will give string because typeof name is string.
Similar window has all the components within it, so the type of will always be undefined and your server side code will execute.
By doing this we will eliminate the change of brower errors which may occur while doing both server and client action in one script frame