Check for mobile, tablet and desktop computers in Dynamicweb Razor-templates

Dynamicweb detects which device is being used when a user visits a website built with Dynamicweb CMS. In Razor you can use this information in the following way:

Base.ChkBoolean(GetGlobalValue("Global:Device.IsTablet"))
Base.ChkBoolean(GetGlobalValue("Global:Device.IsMobile"))
Base.ChkBoolean(GetGlobalValue("Global:Device.IsDesktop"))

This can be very useful in creating adaptive webdesign as it allows you to serve e.g. images scaled and compressed correctly and directed to a particular device. Note, though, that Dynamicweb CMS has had some problems keeping up with new devices. Meaning that you should always provide a fallback method.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s