Skip to content

Instantly share code, notes, and snippets.

@w-jerome
Last active March 27, 2019 08:42
Show Gist options
  • Select an option

  • Save w-jerome/ff9c0ffbb199dd531d569f7a2d0401f8 to your computer and use it in GitHub Desktop.

Select an option

Save w-jerome/ff9c0ffbb199dd531d569f7a2d0401f8 to your computer and use it in GitHub Desktop.
Javascript — Check if browser support fullscreen
function canGoFullscreen() {
var el = document.body;
var check = typeof el.requestFullscreen !== 'undefined' ||
typeof el.mozRequestFullScreen !== 'undefined' ||
typeof el.webkitRequestFullscreen !== 'undefined' ||
typeof el.msRequestFullscreen !== 'undefined' ||
typeof document.exitFullscreen !== 'undefined' ||
typeof document.mozCancelFullScreen !== 'undefined' ||
typeof document.webkitExitFullscreen !== 'undefined';
return check;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment