CodePen

HTML

            
              <p><code>'ontouchstart' in window</code>? <output id="o1"></ouput></p>
<p><code>document instanceof DocumentTouch</code>? <output id="o2"></ouput></p>
<p>MQ? <output id="o3"></ouput></p>

            
          
!

CSS

            
              
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              // Test 1
console.log(window);
document.querySelector('#o1').innerHTML = ('ontouchstart' in window) ? 'true' : 'false';

// Test 2
document.querySelector('#o2').innerHTML = (window.DocumentTouch && document instanceof DocumentTouch) ? 'true' : 'false';

// Test 3
var style = document.createElement('style');
style.innerHTML = ['@media (',Modernizr._prefixes.join('touch-enabled),('),'modernizr',')','{#modernizr{top:9px;position:absolute}}'].join('');
var modernizr = document.createElement('div');
modernizr.id = 'modernizr';
document.body.appendChild(style);
document.body.appendChild(modernizr);
document.querySelector('#o3').innerHTML = document.querySelector('#modernizr').offsetTop === 9;

            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................