Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Redirect user to portal in mobile view

SwarnadeepNandy
Kilo Sage

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

8 REPLIES 8

HarshTimes
Tera Guru

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){



  }


});


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


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


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?