Giter Site home page Giter Site logo

adoprog / sitecore-mobile-device-detector Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 14.0 37.35 MB

Mobile Device Detector combines the power of 51degrees.mobi database for detecting mobile devices and flexibility of Rules Engine for determining appropriate Sitecore Device.

Home Page: sitecoresnippets.blogspot.com

License: MIT License

ASP 7.57% C# 17.74% PowerShell 74.27% Batchfile 0.42%

sitecore-mobile-device-detector's People

Contributors

adoprog avatar geoffreysmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sitecore-mobile-device-detector's Issues

What rule should be used for iPad?

Hi guys,

I'm using the Detector module for Sitecore 7.1. I just realized that if I set the rules to the default "where the device is mobile", the iPad (testing with iPad Air) will be included in this rule. Even after I added the condition: "and except where the device hardware model contains iPad", the iPad still is included in the rule....

Could you please give me an example of how to exclude the iPad devices from the mobile rule?

Thanks

UserAgentCondition only checks indexOf, rather than respecting selected operator

Hey Alex,

Don't know if I'm missing something, but the UserAgentCondition does not seem to allow the full range of operators offered by StringOperatorCondition. Looking at the source code, it simply checks for the index of the supplied value, rather than passing the correct values to the base method Compare(string, string):

protected override bool Execute(T ruleContext)
{
      Assert.ArgumentNotNull((object) ruleContext, "ruleContext");
      string str = this.Value ?? string.Empty;
      string userAgent = HttpContext.Current.Request.UserAgent;
      if (!string.IsNullOrEmpty(userAgent))
        return userAgent.IndexOf(str, StringComparison.OrdinalIgnoreCase) >= 0;
      else
        return false;
}

Would this be a preferable implementation?

protected override bool Execute(T ruleContext)
{
    Assert.ArgumentNotNull((object) ruleContext, "ruleContext");
    string value = this.Value ?? string.Empty;
    string userAgent = HttpContext.Current.Request.UserAgent;

    if (!string.IsNullOrEmpty(userAgent))
        return Compare(value, userAgent);
    else
        return false;
}

Thanks in advance

Sitecore 7.2 MVC conditional rendering

I've installed the lastest version of this module (https://github.com/adoprog/Sitecore-Mobile-Device-Detector/releases/tag/4.0) on a Sitecore 7.2 MVC website. For a single page I have to change the rendering for mobile devices only. So I have installed the module, I created a new Device (sitecore/layout/Devices/Mobile) called Mobile.

I have changed the layout presentation for the wanted page with the mobile rendering, and everything is working ok, just that on mobile I got an error for all the rest of the pages, because this new device seems to be applied on the entire website.

If I update the device Mobile item with a single rule: "where the device is mobile rule", then my page will be displayed corectly on mobile devices, but for the rest of the website pages I get "No Layout specified....".

If I update the device Mobile with more than one rule, like "where the device is mobile rule and where the Item ID is equal to {X}", then all the pages will be displayed on mobile devices with the Default device (which is ok), but my specified page will not be displayed with the different rendering for mobile.

Is there any chance I could set up conditional rendering only for a single item? I cannot setup the rules at the /sitecore/system/Settings/Rules/Conditional Renderings/Global Rules level, because we are using MVC and Global conditional renderings don’t work with MVC.
Also I cannot set up this rules on standard values template level, as we are not using sitecore DMS module (Sitecore personalization).

Any suggestions will be appreciated

Documentation request to explain device data file

Copying my comment from marketplace...

Seems to work really well by setting up a device using a Rule (e.g. Is Mobile) and enables things like using Request.Browser.IsMobile in your code.

Can you add some documentation to explain the options with 51degrees?
As I understand it you get the "Lite" data included with the package and this is free but you have to manually update the data file from http://51degrees.codeplex.com/

Or you can sign up to premium and then it automatically updates the data file, but you have to put some settings in the Web.config file (which you copy from the config file included in App_Data?)

Sitecore 8 support?

I'm working on upgrading a client to Sitecore 8 and they are using this module. I noticed the module is marked as working with 7.5, but not 8, on the marketplace.

Is there a timeline for a Sitecore 8 version?

'Rules Set Editor' not showing Device rules (SC7.2)

Hi

My customer requested to include this module in our solution, as it's working splendidly on the JetStream demo site (SC6.6). I successfully installed the module, but I cannot find the new rules in the 'Personalize the Component' dialog when creating a new condition.

What I can see, is when I create a rules field in a template, I can set the source to the conditions/rules created by the module.

How do I make the new rules/conditions available in the 'Personalize the Component' window in page editor mode? The goal is, to show/hide components based on 'is mobile' rule(s).

image

Exception when no user agent is provided

Hello

We have the situation that we do an server side request on a page of us. In that request we have no user agent configured.

In the class DeviceResolverHelper on line 145 you assume that the user agent is not null. It would be better to add a check before. We do it for now before we start the evaluation of the device.

Thanks!

MDD not showing up in rule set editor in SC 7.2

Hi,

We have a new 7.2 site we are working on. Have installed your module, however in the Rule Set Editor no device detection rules are showing up. I can see the DLL in the site bin folder, the 51 deg data in place, the config file and the items in the master DB, etc but no slow in the rule editor.

Any thoughts?

Thanks

Multi-Language Issue

We have a site that has 6 language versions. We found that when the site was accessed with a context language other than English, the mobile detection did not work. This is because the GetRulesDevice method uses the context language, but the Device items only have English versions. In other languages, no devices are returned and the mobile detection fails. I was able to fix this by updating the GetRulesDevice method to change the Context.Language to English before retrieving the device list and change it back to whatever it was afterward.

I created a Fork with my changes: https://github.com/rmatherly/Sitecore-Mobile-Device-Detector. There may be a way to improve on this or make it configurable, but it solved the issue for me, so I wanted to share it.

Cannot change persisted device

There doesn't seem to be a way to change the persisted device once you set it. I want to provide links on the Desktop and Mobile versions of my site to allow users to manually switch back and forth. I setup links with "?sc_device=deviceName&persisted=true" on each site, but I found that it only works once. For example, if I am on the Desktop version and I click the link with "?sc_device=Mobile&persisted=true" then it works as expected and the mobile site is displayed. If I then click the link to go back to the Desktop site "?sc_device=Default&persisted=true", it stays on the mobile site.

Please return to delivering as Sitecore Package

Ideally this module would be delivered as a Sitecore Package (vs an update file), following the standard naming convention of Sitecore modules, so that it can be easily installed w/ Sitecore Instance Manager.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.