With this approach we want to know all the details about HTML5 and CSS3 support that the Detector with its Modernizr test can provide us with, while at the same time we try to achieve the most stability and support for devices with little processing power. Throwing Modernizr into an old phone is useless as there is a high probability it may never finish loading. To avoid this situation, we assess a visitor's HTML capabilities by analyzing the UA string with WURFL. We use the xhtml_support_level
WURFL property. When it is equal to or higher than 3
, we include Detector; otherwise, we rely on the default screen width obtained from WURFL.
The implementation here is very similar to our first example except that in place of the cookie with the screen size we use Detector.
We start by loading the wurfl_onsite
module inside the constructor, as shown in the following code:
function __construct(){ [...] $this->wurfl_object=getDDLobject('wurfl_onsite'); $this->...