Determine browser in microfow

1
Hi How can I determine and redirect based on browser in a microflow/java action Thankyou
asked
2 answers
3

I believe the only moment you could capture this information is if you have an IMendixRequest. You can access these requests when the user is logging in (when you override the login action) or when the user is using a request handler (e.g. through a deeplink).

In this case, I would suggest you capture this information when a user logs in and store it in the account object. Then, in your microflow, you can split on this attribute.

answered
0

I'm just using this for now in that request handler thingamabob:

HttpServletRequest servletRequest = request.getHttpServletRequest();
        String userAgent = servletRequest.getHeader("User-Agent");
        String newUrl="./index.html";
        String needle="Trident";
        String haystack=userAgent;
        if(haystack.toLowerCase().contains(needle.toLowerCase())){
            newUrl="http://www.google.com";
        }
        String pageContent=""+
            "<html>"+
            "    <head>\n"+
            "   </head>\n"+
            "   <body>\n"+
            "       <script>\n"+
            "           window.location=\""+newUrl+"\";\n"+
            "       </script>\n"+
            "   </body>\n"+
            "</html>";
        OutputStream outputStream = response.getOutputStream();
        IOUtils.write(pageContent, outputStream);
        IOUtils.closeQuietly(outputStream);
answered