Question

I would like to have two layouts in my website: first for tablets and desktop - 'desktop mode', and the second one - 'mobile', only for smartphones. I have created a device layouts in Kentico and bought 51Degrees premium license for device recognition.

When I switch user agent in chrome/firefox on my desktop the site is working properly. Unfortunatelly when I use real smartphone it doesn't work at all, I always get the desktop version of the website. I don't understand why because in both cases I used exactly the same user agent - I used for it 51degrees user agent tester:

Samsung Galaxy Tab: Mozilla/5.0 (Linux; Android 4.0.4; GT-P7500 Build/IMM76D) AppleWebKit/537.36 (KH TML, like Gecko) Chrome/32.0.1700.99 Safari/537.36

Sony Xperia M: -Mozilla/5.0 (Linux; Android 4.1.2; C1905 Build/15.1.C.2.8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Mobile Safari/537.36

To recognize smartphones I tried to use

CurrentDevice.IsSmartPhone

(it is 51degrees property) in Kentico Site Manager -> Development -> Device Profiles -> Mobile -> General -> Macro, but Kentico can't find such property. So instead of that I use

CurrentDevice.IsMobile == true and CurrentDevice.IsTablet == false

Do you have any idea why there is a problem with device recognition? What am I doing wrong?

Was it helpful?

Solution

What is the order of the device profiles? If the first in the list is evaluated as true, the rest of the profiles is ignored.

Also, you are assigning the values to the macros, have you tried using just CurrentDevice.IsMobile && !CurrentDevice.IsTablet macro?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top