How do we get appVersion/ userAgent details in Client Controller of widget in Service Portal?

Pranshu3
Tera Expert

Hi all,

I had implemented "navigator.appVersion" for CMS Portal pages to get OS Name (like Win/ Mac/ X11/ Linux). But when moving to Service Portal pages in ServiceNow, I am unable to use the same code on client script.

Could you please help me a way out to detect appVersion(OS) or userAgent(device) in Service Portal widgets?

Thanks & regards,
Pranshu

1 ACCEPTED SOLUTION

Oleg
Mega Sage

You can include $window in the list of parameters of the client controller and to use $window.navigator.userAgent and $window.navigator.appVersion inside of your code.

View solution in original post

3 REPLIES 3

Oleg
Mega Sage

You can include $window in the list of parameters of the client controller and to use $window.navigator.userAgent and $window.navigator.appVersion inside of your code.

Thanks @OlegKi.

Just to add, I was able to use $window as window without adding anything to the parameters in client controller.