Moff.detect

This is the Moff plugin which detects OS, browser, HTML5 and CSS3 features support.

applicationCache

Determines whether browser support application cache object for the window.

Returns boolean.

if (Moff.detect.applicationCache) {
	// do something...
}

audio

Determines built-in media support via <audio> element.
This object contains the list of audio formats with boolean values.

Returns object.

ogg - Browser supports audio/ogg audio format.
mp3 - Browser supports audio/mpeg audio format.
wav - Browser supports audio/wav audio format.
m4a - Browser supports audio/x-m4a or audio/aac audio format.

if (Moff.detect.audio.mp3) {
	// auto mp3 is supported by browser
}

browser

Object with user browser name and version. Pay attention Internet Explorer 11 won't be matched as msie because browser detection is based on navigator.userAgent. Better try to user feature-specific detected code then browser.

Returns object with of the keys:

chrome - Google Chrome
mozilla - Mozilla Firefox
msie - Internet Explorer
opera - Opera
webkit - Webkit based browser
edge - Microsoft Edge

Browser version is stored in version key.

if (Moff.detect.browser.chrome) {
	// user browser is Google Chrome
}

Moff.detect.browser.version; // 42.0.2311.90

canvas

Determines whether browser support <canvas> HTML element.

Returns boolean.

if (Moff.detect.canvas) {
	// browser support canvas
}

canvasText

Determines whether browser support canvas 2D fillText method.

if (Moff.detect.canvasText) {
	// canvas 2D fillText is supported
}

dragAndDrop

Determines whether browser support draggable or ondragstart, ondrop events.

Returns boolean.

if (Moff.detect.dragAndDrop) {
	// realize drag and drop feature
}

hashChange

Flag to determine whether window hashchange event is supported.

Returns boolean.

if (Moff.detect.hashChange) {
	// hashchange event is supported
}

history

Detection of HTML5 History API pushState support.

Returns boolean.

if (Moff.detect.history) {
	// pushState is supported
}

indexedDB

Indicates if the browser support persistently stored data. This property contains indexedDB object or false.

Returns boolean .

if (Moff.detect.indexedDB) {
	// browser's indexed data base is supported
}

isMobile

Determines whether user devices is mobile.

Returns boolean.

if (Moff.detect.isMobile) {
	// user devices is mobile
}

localStorage

Flag to determine whether browser support local storage object.

Returns boolean.

if (Moff.detect.localStorage) {
	// browser support local storage object
}

OS

Object which contains user OS name.

Returns object with one of the following keys:

iOS - Apple iOS
macOS - Apple Mac OS
windows - Microsoft Windows OS
android - Google Android OS
windowsPhone - Microsoft Windows Phone OS

if (Moff.detect.OS.android) {
	// user OS is android
}

postMessage

Determines whether browser support window.postMessage method.

Returns boolean.

if (Moff.detect.postMessage) {
	// window postMessage is supported
}

sessionStorage

Flag to determine whether browser support session storage.

Returns boolean.

if (Moff.detect.sessionStorage) {
	// window.sessionStorage is supported
}

supportCSS3(property)

Determines does the browser support passed CSS3 property.

Returns boolean.

Arguments:

property - CSS3 property

if (Moff.detect.supportCSS3('transition')) {
	// browser supports CSS3 transition property
}

touch

Indicates if the browser supports touch events, which does not necessarily reflect a touchscreen device.

Returns boolean.

if (Moff.detect.touch) {
	// browser support touch events.
}

video

Determine whether the browser support <video> HTML5 element.

Returns object with supported video formats:

ogg - Browser supports video/ogg format.
h264 - Browser supports video/mp4 format.
webm - Browser supports video/webm format.

if (Moff.detect.video.h264) {
	// browser can play video/mp4 format
}

webSockets

Flag to indicates if the browser support web sockets.

Returns boolean.

if (Moff.detect.webSockets) {
	// your browser supports Web sockets
}

webWorkers

Determine if the browser support web workers.

Returns boolean.

if (Moff.detect.webWorkers) {
	// browser supports Web workers
}