Warning: array_merge(): Argument #4 is not an array in /var/www/profile/Profile.php on line 203
A pragmatic means (and extremely early release) of determining device features + constraints by the folks @yiibu.
This is Profile's user-facing inspector which can be used for reference when testing on devices. Visit GitHub to download the source or have a look at our Adaptation presentation for a general overview of how Profile works.
Please expect bugs. (Ironically!) currently best viewed on the desktop. Documentation will follow soon.
id: generic, version: 1.1
Native JSON Object
return !!window.JSON?1:0;
From window.innerWidth if available, otherwise from screen.width.
return (window.innerWidth>0)?window.innerWidth:screen.width;
From window.innerHeight if available, otherwise from screen.height.
return (window.innerHeight>0)?window.innerHeight:screen.height;
Get the colour depth of the device display.
return screen.colorDepth;
Is an XMLHttpRequest object available on this device.
try { xhr = new XMLHttpRequest(); } catch (e) {}
try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
return +(xhr!=null);
Support for HTML5 video?
var video = +!!document.createElement('video').canPlayType;
if(video){
var v = document.createElement("video");
v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')?video+='-h264':false;
v.canPlayType('video/ogg; codecs="theora, vorbis"')?video+='-ogg':false;
v.canPlayType('video/webm; codecs="vp8, vorbis"')?video+='-webm':false;
}
return video;
Support for HTML5 geo-location API
return +!!navigator.geolocation;
Which version of the Adobe Flash Player (if any) is installed on this device.
try{
try{
var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
try { axo.AllowScriptAccess = 'always'; }
catch(e) { return '6,0,0'; }
} catch(e) {}
var v = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1] ;
return v.replace(/,/gi, '.');
}catch(e){
try{
if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
var v = (navigator.plugins["Shockwave Flash 2.0"] ||
navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
return v.replace(/,/gi, '.');
}
}catch(e){}
}
return '0.0.0';
Ability to use web fonts.
var sheet,
head = document.head || document.getElementsByTagName('head')[0] || docElement,
style = document.createElement("style"),
impl = document.implementation || { hasFeature: function() { return false; } };
style.type = 'text/css';
head.insertBefore(style, head.firstChild);
sheet = style.sheet || style.styleSheet;
/* removing it crashes IE browsers */
/* head.removeChild(style); */
var supportAtRule = impl.hasFeature('CSS2', '') ?
function(rule){
if (!(sheet && rule)) return false;
var result = false;
try{
sheet.insertRule(rule, 0);
result = !(/unknown/i).test(sheet.cssRules[0].cssText);
sheet.deleteRule(sheet.cssRules.length - 1);
}catch(e){}
return +result;
} :
function(rule){
if (!(sheet && rule)) return false;
sheet.cssText = rule;
return +sheet.cssText.length !== 0 && !(/unknown/i).test(sheet.cssText)&&sheet.cssText.replace(/\r+|\n+/g, '').indexOf(rule.split(' ')[0]) === 0;
};
return +supportAtRule('@font-face { font-family: "font"; src: "font.ttf"; }');
Are SVG graphics supported?
return +!!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");
Is HTML5 canvas supported.
var canvas = +!!document.createElement('canvas').getContext;
if(canvas){
var c = document.createElement( 'canvas' ).getContext('2d');
typeof c.fillText=='function'?canvas+="-text":false;
}
return canvas;
Ability to create TouchEvent listeners.
try{document.createEvent("TouchEvent");return 1;}
catch(e){return 0;}
Desktop browser
n/aCCBot/1.0 (+http://www.commoncrawl.org/bot.html)