Simone
Simone

Reputation: 21262

Modernizr: how to detect FullScreen API

I want to detect the FullScreen API with Modernizr, but I really can't understand how.

Here's what I tried:

console.log(Modernizr);               // Object {flexbox: true, canvas: true, …}
console.log(Modernizr.fullscreen);    // undefined 
console.log(Modernizr.fullscreenapi); // undefined
console.log(Modernizr.fullScreen);    // undefined

I've tried the development version and a custom build; and yes, I've checked fullscreen-api in the custom build.

Same problem with other non-core detects like contenteditable.

Any suggestions?

Upvotes: 0

Views: 2291

Answers (2)

Simone
Simone

Reputation: 21262

My problem was that I attempted to uncheck everything but fullscreen-api; by the way, when unchecking _domPrefixes it was automatically unchecking fullscreen-api too. Redownloading the custom build with fullscreen-api and _domPrefixes both checked fixed my issue.

The right property to detect is of course Modernizr.fullscreen. Thank you guys.

Upvotes: 0

callmehiphop
callmehiphop

Reputation: 646

Are you using the class names feature? Do you see fullscreen or no-fullscreen on your <html> tag? If you do but you still can't access Modernizr.fullscreen you could just monkey patch it, but that's probably not ideal.

Modernizr.fullscreen = Modernizr.fullscreen || $('html').hasClass('fullscreen');

Otherwise, I would follow Ian's example and just dump your whole Modernizr file into a fiddle for others to look at.

Upvotes: 1

Related Questions