CoolDeviceDetector Service

To get started you will need to include the cooldevicedetector.js file found here.
After that script include you will need to create the rules you wish for CoolDeviceDetector to follow and pass those into the method southernco.devicedetector.init
NOTE: The rules will be processed in the order in which they are found so start with the most specific rules first.
Click here to view an example of how CoolDeviceDetector can be used.
Below is an example of how to call southernco.devicedetector.init

southernco.devicedetector.init(
{
rules: {
excludes: [/.*login$/i],
devices:
{
Desktop:
{
excludes: [/.*device=desktop/i],
rules:
[
{ pattern: /^(https?:\/\/)([^//]*)\/?(.*)$/i, replacement: "$1$2?device=desktop" }
]
},
Tablet:
{
excludes: [/.*device=tablet/i],
rules:
[
{ pattern: /^(https?:\/\/)([^//]*)\/?(.*)$/i, replacement: "$1$2?device=tablet" }
]
},
Mobile:
{
excludes: [/.*device=mobile$/i],
rules:
[
{ pattern: /^(https?:\/\/)([^//]*)\/?(.*)$/i, replacement: "$1$2?device=mobile" }
]
}
}
},
doDynamicLoad: true,
ignoreQueryStringPreference: false,
error: function(msg) {
alert(msg);
}
});