Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fullscreen api not working on ios when using javascript

Tags:

javascript

fullscreen api is not working in ios safari and chrome. I am trying to show a image in full screen but its not working in ios safari, could anyone help me on the same. Am i using the right property of document.

function getBrowserFullscreenElementProp() {
  if (typeof document.fullscreenElement !== "undefined") {
    return "fullscreenElement";
  } else if (typeof document.mozFullScreenElement !== "undefined") {
    return "mozFullScreenElement";
  } else if (typeof document.msFullscreenElement !== "undefined") {
    return "msFullscreenElement";
  } else if (typeof document.webkitFullscreenElement !== "undefined") {
    return "webkitFullscreenElement";
  } else {
    throw new Error("fullscreenElement is not supported by this browser");
  }
}

Tried

function getBrowserFullscreenElementProp() {
  if (typeof document.fullscreenElement !== "undefined") {
    return "fullscreenElement";
  } else if (typeof document.mozFullScreenElement !== "undefined") {
    return "mozFullScreenElement";
  } else if (typeof document.msFullscreenElement !== "undefined") {
    return "msFullscreenElement";
  } else if (typeof document.webkitCurrentFullScreenElement !== "undefined") {
    return "webkitCurrentFullScreenElement";
  } else {
    throw new Error("fullscreenElement is not supported by this browser");
  }
}
like image 408
dev Avatar asked Sep 06 '25 03:09

dev


1 Answers

As per can i use: Safari for iPhone does not support the fullscreen API.

like image 182
Quentin Avatar answered Sep 07 '25 19:09

Quentin