5

Just wanted to check with the community if the following context engine JavaScript file is mandatory:

<script type="text/javascript" src="js/discover-min.js"></script>

As this is a server side device detection service I think it's pretty safe to say that it isn't, but I'm sure there's a good reason for having it.

I'm testing on a local install of adding / taking away and the variables in my ADF remain the same.

3
  • 1
    Actually think i have the answer: docs.sdl.com/LiveContent/content/en-US/… it's to detect aspects (Screen sizes etc) of a device.
    – johnwinter
    Commented Nov 5, 2014 at 13:49
  • Go ahead and list it as the answer sir. We don't want to leave an unanswered question to keep good stats. Commented Nov 5, 2014 at 16:02
  • i was waiting to see if there's someone out there that has more detail and wants to earn some points
    – johnwinter
    Commented Nov 5, 2014 at 16:28

2 Answers 2

4

This file is not mandatory. It adds client-side device detection details as you've established. If the file is not used, then the context engine will resolve the device properties using the remaining resolvers (eg user agent parser, the context device repository, or a custom expression).

Clearly without the client detection JavaScript, there is no way of knowing the user's actual browser size and you'll see the device or browser default instead.

Hope this helps.

2
  • 1
    +1 - To give an example, some attributes like screen size change depending on user's behaviour, e.g. they might have zoomed in, resized browser window, accessing the page from within a panel within an app. Now we have a good stab at it with the server side database resolution (so we have a good idea whether it is small, medium, large), however the client side detection (with this JS file) updates these screen size attributes based on local browser introspection.
    – ian
    Commented Nov 6, 2014 at 7:51
  • 1
    Note also, that the only attributes updated by the discover.js in the Tridion 2013 SP1 release are browser.displayWidth, browser.displayWidth, browser.displayColorDepth, device.pixelRatio, device.displayWidth and device.displayHeight.
    – ian
    Commented Nov 6, 2014 at 7:55
3

If you do not have a license for SDL Mobile, but want to use the Context Engine you can use this JS file to provide most (?all) of the Context Engine claims in the ADF. It works by setting a cookie on the first page load, so any server side code using these claims will only work on second and subsequent requests (the Context Engine provides some defaults on the first request).

If you do have an SDL Mobile license, you can use the device database to do first request detection of many attributes, however as Ben's answer and Ian's comments state, some things like browser size can only reliably come from the JS.

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.