The CreatorCon Call for Content is officially open! Get started here.

How to check in script include if the user is using a mobile browser to view ServiceNow

siakam
Kilo Expert

I am currently working on allowing our users to access SN on mobile devices. When a user is accessing our SN instances from a mobile browser, we only want them to see the Service Portal. There are 2 ways that I'm thinking of doing this:

1. Create a script include that returns true if the user is on a mobile browser.
2. Check the transaction log table for the useragent

The problem with 1 is that I havent found any method that allows me to get the browser data correctly.
The problem with 2 is that the transaction log table isnt updated when the user is on the Service Portal.


I wanted to know if there was any way in a script include to determine what browser is currently in use?

Or

Is possible to get the transaction log table to log browser information when a user is on the Service Portal?

Or

Is there some other way of doing this that I havent found yet?

 

If its not possible, i

1 ACCEPTED SOLUTION

siakam
Kilo Expert

I have found out from ServiceNow that gs.IsMobile does not run on Menu Item in Service Portal. I will have to use CSS to hide a link on my navigation menu. Thank you for everyones help.

View solution in original post

6 REPLIES 6

Brian Lancaster
Tera Sage

I don't know if you can use a script include to check the browser since it is a Service Side and not client side.  As for logging when users are on the service portal take a look at sp_log table.

That table doesnt log the UserAgent information so it wont work.

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

You can test, the "Testing for mobile devices in scripts" Doc article explains:

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/administer/tablet_and_mobile_ui/r...

This only works if youre using the Mobile UI or the mobile app. I need to do this check on the Service Portal