‎08-03-2016 11:31 PM
Hi,
I want to redirect any non admin user to self service portal in mobile view. It can be easily achieved in desktop view, but i think UI Scripts and Login rules are not working in mobile interface. Can anyone help me out here?
Thanks
Swarnadeep
‎08-04-2016 12:18 AM
Make a global UI Script and try to play with below code in it
addLoadEvent(function() {
try {
// Variables
//var newURL = window.location.protocol + "//" + window.location.host + "/";
var usrAgent = navigator.userAgent;
var usingMobile;
// Evaluate if coming from mobile
var winSP = usrAgent.indexOf("Windows CE") > -1;
var bbSP = usrAgent.indexOf("BlackBerry") > -1;
var droidSP = usrAgent.indexOf("Android") > -1;
var iPhoneSP = usrAgent.indexOf("iPhone") > -1;
var operaSP = usrAgent.indexOf("Opera Mini") > -1;
// If any is true then user is from mobile device
if(winSP || bbSP || droidSP || iPhoneSP || operaSP){
usingMobile = 'true';
} else {
usingMobile = 'false';
}
window.top.location = newURL + "$m.do";
} catch (err){
}
});
‎07-17-2017 05:11 AM
Should we make any changes to any other modules????/Or this ui script is sufficient????????because i have implemented the script but the functionality did not work.harshtimes
‎07-18-2017 12:46 AM
If you are testing that in mobile then it should work. Share the script which you have written. Also, confirm if there is other script running which is not allowing to do the redirecting.
-Harsh
‎07-22-2017 12:54 AM
harshtimes When i am running this Global UI script it is converting the instance fully in mobile view. I can not access it to desktop view also.
I want my user to be landed in a specific URL from servicenow mobile APP. Can you help me on this?