CurrentDevice.ScreenPixelsHeight Not working

Sid Chudasama asked on June 19, 2017 16:20

Hello,

I'm trying to get height of the device, but {%CurrentDevice.ScreenPixelsHeight%} returns 0.

Thanks

Recent Answers


Brenden Kehren answered on June 19, 2017 18:13

I believe you need to have device profiles enabled. AND if it is enabled and the device isn't recognized then it may return a null/0 value.

1 votesVote for this answer Mark as a Correct answer

Sid Chudasama answered on June 19, 2017 20:07

Device profile is enabled. I'm using chrome browser on Windows 10. I also tried it on a Mac. That means it only recognises mobile devices? Is there any other way to get screen size or browser window size?

Thanks

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on June 19, 2017 20:16

Did you create profiles for your site and apply them?

0 votesVote for this answer Mark as a Correct answer

Sid Chudasama answered on June 19, 2017 20:33

So if i'm understanding these right, i have to create profiles for each different screen sizes that i want the macro to identify?

0 votesVote for this answer Mark as a Correct answer

Anton Grekhovodov answered on June 20, 2017 12:39

Hi Sid,
There was a similar question Macro doesn't work. CurrentDevice macro uses ~/App_Data/CMSModules/DeviceProfile/devices.xml file to detect devices based on their user agent. The file doesn't include any information about desktop browsers, so if you change the user agent in developer console, you will see the result.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.