7

I am using the Context Engine (without an SDL Mobile license, so no device database) to determine browser display width and drive layout of a site.

This relies on a JavaScript file (discover-min.js) which sets a cookie with browser properties which the Context Engine reads and turns into ADF claims. This works great for the second and subsequent requests, but on the first request (when there is no cookie), I get default values, in this case 800.

Actually I want to use 1024 as my default - is there any way to change this, or at least determine if I am being provided with a default value (to distinguish the case where the browser display width is actually 800 pixels)?

5
  • Could you simply not check if the cookie exists ? Would this not work with what you try to achieve ? Commented Aug 14, 2014 at 12:01
  • Good idea - that would work as a workaround, but I was hoping for a more API/config based solution
    – Will Price
    Commented Aug 14, 2014 at 14:00
  • Is an SDL Mobile licence needed for the device database then? I didnt see anything mentioning that in the Installing Context Engine Cartridge section of the docs.
    – Neil
    Commented Aug 15, 2014 at 12:30
  • Thats my understanding, but you could contact your SDL sales guy to confirm... There is however no license file so it will just work.
    – Will Price
    Commented Aug 18, 2014 at 14:02
  • Harald - in the end I used your approach, so if you add it as an answer I will accept it...
    – Will Price
    Commented Aug 18, 2014 at 14:04

1 Answer 1

2

Have you tried setting a custom vocabulary for browser.displayWidth, but with a different default value? For example:

<vocabulary>
    <aspects>
        <aspect name="browser">
            <properties>
                <property name="displayWidth" type="integer" default="1024"/>
            </properties>
        </aspect>
    </aspects>
</vocabulary>

See the documentation on Creating new aspect properties in a custom vocabulary file. This is untested and unsupported at this stage, but might provide the override that you are looking for. Avoid changing the type of the property in case there are any undesired side-effects.

2
  • While I could get defaults put in for other claims in the ADF, unfortunately the context engine browser values seem to get overridden, so this method does not work, I still end up with 800
    – Will Price
    Commented Aug 18, 2014 at 13:46
  • Thanks for raising this question. I think it'd be great if we could give the runtime configuration control without needing to update the vocabulary definition (since the vocabulary definition may not be in your direct control) and I'll look into the best way that we can achieve this in the future.
    – ian
    Commented Sep 2, 2014 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.