How to remove Address Bar in Safari in iOS?

firedev picture firedev · Oct 25, 2011 · Viewed 47.3k times · Source

Old trick with window.scrollTo(0,1); doesn't work. And even worse, the address bar moves only a bit and gets stuck halfway out sometimes.

Answer

Jon Dolan picture Jon Dolan · Feb 26, 2012

It is a combination of many things as I have found when researching this issue for myself. Here's the code that properly works on iOS5: (I know I'm a little late, but an answer is an answer, hopefully it can help people in the future)

<!DOCTYPE html>
<html>
<head>
<title>Hide Address Bar</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
 window.addEventListener("load",function() {
   setTimeout(function(){
    window.scrollTo(0, 0);
    }, 0);
 });
</script>
<style>
 body { min-height: 480px; }
</style>
</head>
<body>
 <h1>Content</h1>
</body>
</html>

Source: http://24ways.org/2011/raising-the-bar-on-mobile

Example: http://jsbin.com/isenax/