Skip to content

API: Script: Classification Overriding

ebollens edited this page Oct 3, 2011 · 5 revisions
Clone this wiki locally

Description

Through the override library (mwf.override), the framework allows a user to override the way the framework classifies the user with any classification below the one that their devices is actually regarded as. Once an override has been triggered, until it is disabled, all handlers and functions will observe the override specification.

Performing an Override

This is possible by providing the GET parameter override on any page that includes the JS Handler with the value basic, standard or full. In doing so, the page in question will be refreshed to the classification level specified.

An example of a URL that enables an override is as follows (where sample.php includes the JS handler):

sample.php?override=standard

To disable the override, one may then specify the GET parameter override with the value no.

An example of a URL that disables the framework is as follows (where sample.php includes the JS handler):

sample.php?override=no

Compatibility Note: MWF 1.0-1.1 only offered this functionality on the front splash page (index.php), and instead used the GET parameter ovrcls. In MWF 1.2, the GET parameter ovrcls is still accepted and valid on the front splash page, but its functionality is now expanded to encompass any page with the framework on it.

A user is not allowed to override to a classification higher than the one that their device actually is. This prevents libraries from loading that are incompatible with the actual device capabilities.

Compatibility Note: MWF 1.0-1.1 allowed the user to override to any classification, whereas MWF 1.2 only allows the user to override to a classification less than the classification of the actual device.

Telemetry About the Override

The mwf.classification library allows one to determine if an override is active:

  • mwf.classification.isOverride()

If an override is valid, the behavior of mwf.classification will also be modified. In such a case, the following methods will produce information based on the override rather than the actual device:

  • mwf.classification.isFull()
  • mwf.classification.isStandard()
  • mwf.classification.isBasic()

The mwf.classification object then provides an additional set of methods to access the actual classification information about a device. These methods are not available if an override is not present (as the above classification methods will return the actual values):

  • mwf.classification.wasFull()
  • mwf.classification.wasStandard()
  • mwf.classification.wasBasic()

In addition, if the device is classified as a desktop and an override is present, it will classify the device as in preview mode and return true to the following function:

  • mwf.classification.isPreview()

If config/preview.php is configured and the page is under the specified domain, then this preview mode will also trigger the preview menu bar that allows the user to switch classifications (NOTE: The preview menu functionality is currently under refactor, as it is not optimized yet for MWF 1.2).

Something went wrong with that request. Please try again.