How do I hide the address bar on iPhone?

前端 未结 11 945
情话喂你
情话喂你 2020-12-02 12:37

How do I hide the address bar on iPhone?

I tried two different methods so far:

  • The scroll down one pixel trick with JavaScript on page load

11条回答
  •  囚心锁ツ
    2020-12-02 13:05

    UPDATE: Apple removed support for minimal-ui in iOS 8 so this is no longer a useful answer :(


    For new googlers looking into this: As of iOS 7.1 there's a new minimal-ui mode that works on mobile Safari:

    minimal-ui

    It's enabled by setting the minimal-ui property on the viewport:

    
    

    You can also use it in conjunction with other properties like so:

    
    

    Of note, there's no minimum content length requirement as there is with the scrollTo hack. There's a great overview of this new mode here. (That's where the above image comes from.) He also lists some shortcomings.

    The only official documentation I could find on this is a note in Apple's iOS 7.1 release notes:

    A property, minimal-ui, has been added for the viewport meta tag key that allows minimizing the top and bottom bars on the iPhone as the page loads. While on a page using minimal-ui, tapping the top bar brings the bars back. Tapping back in the content dismisses them again.

    For example, use

提交回复
热议问题