Skip to content

Instantly share code, notes, and snippets.

@valentincognito
Last active June 5, 2020 07:42
Show Gist options
  • Save valentincognito/1d0d0771eb04b76c404c4432f0f28c1b to your computer and use it in GitHub Desktop.
Save valentincognito/1d0d0771eb04b76c404c4432f0f28c1b to your computer and use it in GitHub Desktop.

Blocking back button on browser (chrome tested)

history.pushState(null, document.title, location.href); 
history.back(); 
history.forward(); 
window.onpopstate = function () { 
  history.go(1); 
};

Fullscreen methods

Manifest file

link(rel='manifest', href='/manifest.json')

{
  "short_name": "name",
  "name": "name",
  "start_url": "/",
  "background_color": "#000",
  "display": "fullscreen",
  "theme_color": "#000",
  "orientation": "portrait"
}

HTML meta tags

meta(name="HandheldFriendly" content="True")
meta(name="MobileOptimized" content="320")
meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no viewport-fit=cover")
meta(name="apple-mobile-web-app-capable" content="yes")
meta(name="apple-mobile-web-app-status-bar-style" content="black-translucent")
meta(name="mobile-web-app-status-bar-style" content="white")
meta(name="format-detection" content="telephone=no")
meta(name="theme-color" content="#000")
notes

viewport-fit=cover: real full screen for newer phones with infinity screen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment