This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

FULLSCREEN BUTTON
#4
Hi,

Somehow Android is having issues with the touchstart parameter, removed it in the sample below:
Code:
$(function(){
  // Fullscreen function
  function fullScreen() {
    if (!document.fullscreenElement &&
        !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) {
      if (document.documentElement.requestFullscreen) {
        document.documentElement.requestFullscreen();
      } else if (document.documentElement.msRequestFullscreen) {
        document.documentElement.msRequestFullscreen();
      } else if (document.documentElement.mozRequestFullScreen) {
        document.documentElement.mozRequestFullScreen();
      } else if (document.documentElement.webkitRequestFullscreen) {
        document.documentElement.webkitRequestFullscreen();
      }
    } 
  }
  (function() {
    var StartUserInput = function (e) {
      fullScreen();
      // Check if document is loaded in iframe
      if (window.frameElement){
        // Remove event listeners from parent
        var thisparent = window.parent;
        thisparent.document.removeEventListener('touchend', StartUserInput);
        thisparent.document.removeEventListener('click', StartUserInput);
      }
      // Remove events
      document.removeEventListener('touchend', StartUserInput);
      document.removeEventListener('click', StartUserInput);
    };
    // Check if document is loaded in iframe
    if (window.frameElement){
      // Add event listeners to parent
      var thisparent = window.parent;
      // Event listener for iOS 9+ (is now touchend event)
      thisparent.document.addEventListener('touchend', StartUserInput);
      thisparent.document.addEventListener('click', StartUserInput);
    }
    // Event listener for iOS 9+ (is now touchend event)
    document.addEventListener('touchend', StartUserInput);
    document.addEventListener('click', StartUserInput);
  })();
});
BR,

Erwin
Reply


Messages In This Thread
FULLSCREEN BUTTON - by gdimaria - 16.01.2019, 18:05
RE: FULLSCREEN BUTTON - by gdimaria - 17.01.2019, 13:13
RE: FULLSCREEN BUTTON - by Erwin van der Zwart - 19.01.2019, 20:08
RE: FULLSCREEN BUTTON - by alexll - 26.11.2021, 14:53
RE: FULLSCREEN BUTTON - by gdimaria - 21.01.2019, 12:21
RE: FULLSCREEN BUTTON - by Daniel - 26.11.2021, 15:03
RE: FULLSCREEN BUTTON - by alexll - 26.11.2021, 15:15
RE: FULLSCREEN BUTTON - by Daniel - 26.11.2021, 15:31
RE: FULLSCREEN BUTTON - by alexll - 26.11.2021, 17:32
RE: FULLSCREEN BUTTON - by admin - 29.11.2021, 08:13
RE: FULLSCREEN BUTTON - by alexll - 29.11.2021, 10:51

Forum Jump: