Mobile page not redirecting correctly when user logins

Created by Vester Business Support Team, Modified on Fri, 20 May 2022 at 01:08 PM by Vester Business Support Team

If you are using the responsive mode in atvise, the system automatically detect if you are using a Mobile, Tablet or Desktop, and it will also recognize if you are using them in portrait or landscape orientation.


However if you are using the default login system in atvise, the login will redirect the logged user into the default user screen, no matter what type of device.   So you will not see the correct screen when login.


This can be sold with a simple redirect script as follows.


1. Edit the screen you are using as Landing Screen for your user, the one you setup as the default user screen.

2. Once in the display editor Open the Code Editor and paste the script



Copy and paste the this script:

webMI.addOnload(function() {
        var prefix = "AGENT.DISPLAYS"; 
        var baseaddress = location.pathname.split("/").pop();
        var lang = location.pathname.split("/")[1];
        baseaddress = baseaddress.replace("AGENT.DISPLAYS", "");
        if(webMI.getClientInfo().isMobile==true){
               prefix = prefix + ".MOBILE";
               if(webMI.getClientInfo().isLandscape == true){
                       prefix = prefix + ".Landscape";
               } else {
                       prefix = prefix + ".Portrait";
               }
               location = "/"+ lang + "/xhtml/"+  prefix + baseaddress;             
        }
        if(webMI.getClientInfo().isTablet==true){
               prefix = prefix + ".TABLET";
               if(webMI.getClientInfo().isLandscape == true){
                       prefix = prefix + ".Landscape";
               } else {
                       prefix = prefix + ".Portrait";
               }              
 
               location = "/"+ lang + "/xhtml/"+  prefix + baseaddress;
        }
});


3. Save the screen and reload the runtime browser.  It should work fine at this point.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article