Overrule the Mendix device type recognition mechanism

0
There are already phablets on the market and the hybrid tablets (laptop replacements) are coming up. Some users prefer the tablet interface where other users prefer the desktop interface on their tablet. Similarly users with large screen phones could prefer the tablet interface. We would like the user to able to choose their interface. Is there a way to overrule the automatic device type recognition mechanism of Mendix?
asked
2 answers
1

This should be possible. I have just tested it on my own local machine and it should work. You can append a get parameter to the end of the url to tell the mendix platform that you want the desktop, tablet or phone.

The get parameter is ?profile=phone, ?profile=desktop and profile=tablet.

If you create a piece of html and javascript you should be able to allow the user to select from a dropdown their view and open up the application on a said device.

The code could look something like:

<script type="text/javascript">
    function selectDevice(obj){
        var urlString = ".";
        var selectedDevice = obj.options[obj.selectedIndex];
        if (selectedDevice.value != "nothing"){
                window.location = urlString + '?profile='+selectedDevice.value;
        }
    }
</script>


<form>
    <select onchange="selectDevice(this)">
    <option value="nothing">Select device</option>
    <option value="desktop">Desktop</option>
     <option value="tablet">Tablet</option>
    <option value="phone">Phone</option>
    </select>
</form>

I just test this. If you put the javascript in the html file. Then put the html in a html snippet in the modeller it should work.

Regards

answered
0

Yes, this is very easy, just put ?profile=phone/tablet/desktop behind your URL.

Like this: http://localhost:8080/?profile=phone

answered