Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...DotNetNuke.Services.ClientCapability.IClientCapability.IsMobile doesn't work?DotNetNuke.Services.ClientCapability.IClientCapability.IsMobile doesn't work?
Previous
 
Next
New Post
9/23/2012 11:30 PM
 
    We have a module called Cross Video Gallery.  In this module, we use flash to play videos/audios in pc, and try to use html 5 syntax to play videos/audios in mobile(iphone/ipad..etc). We use below code to detect if current visitor is based mobile.

      DotNetNuke.Services.ClientCapability.IClientCapability device=DotNetNuke.Services.ClientCapability.ClientCapabilityProvider.CurrentClientCapability;

     if ( device.IsMobile)......



      However, the device.IsMobile doesn't work. Its value keep as "False" even we visit our site via Iphone.  We also test device.SupportsFlash property, it is always "False" even we use pc browser(Firefox/IE...etc).

     Do I miss something? Or these properties only work on dotnetnuke professional edition, and not applied on dotnetnuke community edition?

     Thanks.

Over 20 + professional dnn modules for News Article, Store, Video Gallery, Photo Gallery, Ultra Flash Player,YouTube Video, Image Slide show, Skin Chameleon and much more from DnnModule.com
 
New Post
9/24/2012 12:28 AM
 
Have a look at IClientCapabilityProvider.GetAllClientCapabilityValues();

and grab a copy of the API from the downloads page.

Bill
 
New Post
9/24/2012 6:50 AM
 

   Thanks for your suggestion. However, the GetAllClientCapabilityValues() returns a IDictionary<string, List<string>> and it has no help to detect IsMobile property. For example:

     foreach (var item in DotNetNuke.Services.ClientCapability.ClientCapabilityProvider.Instance().GetAllClientCapabilityValues())
               {
                   string s = item.Key;
                   foreach (var v in item.Value)
                   {
                       string a = v;
                   }
              
               }
      In debug module, you will see the first item.Key is "IsMobile", and item.Value has two values, one is "False", the other is "True". No helps.

       We write a simple method to detect mobile access as followings:
      public bool IsMobile()
        {
            string m = "ipad|iphone|nokia|sony|ericsson|mot|samsung|sgh|lg|sie|philips|panasonic|alcatel|lenovo|cldc|midp|wap|mobile";
            string ua = System.Web.HttpContext.Current.Request.UserAgent;
            if (Regex.IsMatch(ua, m, RegexOptions.IgnoreCase))
                return true;
            else
                return false;
        }

      Above code works well on Iphone/Ipad.  But it has many limitations.

     I guess the DotNetNuke.Services.ClientCapability.ClientCapabilityProvider.CurrentClientCapability.IsMobile property works after config "host - device detection management". But this feature requires you upgrade to dotnetnuke commercial edition.


Over 20 + professional dnn modules for News Article, Store, Video Gallery, Photo Gallery, Ultra Flash Player,YouTube Video, Image Slide show, Skin Chameleon and much more from DnnModule.com
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...DotNetNuke.Services.ClientCapability.IClientCapability.IsMobile doesn't work?DotNetNuke.Services.ClientCapability.IClientCapability.IsMobile doesn't work?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out