开发者

Change iPad/iPhone layout if user adds to homepage

开发者 https://www.devze.com 2023-04-04 18:42 出处:网络
In iPhone/iPad you can have the address bar removed by using a meta-tag on your page. However it only works if a user clicks the \'add to home page button\'.

In iPhone/iPad you can have the address bar removed by using a meta-tag on your page. However it only works if a user clicks the 'add to home page button'.

For more info iPad WebApp Full Screen in Safari

I need to find a way to slightly change the CSS if the user is viewing the page without th开发者_运维百科e address bar(i.e. accessing the site from homepage.).

padding-top:64px;

Has anyone found a way to deal with this issue?


You should look at window.navigator.standalone in JS and then, for example, set standalone class to HTML element, so you could add the following rule to your CSS that would be applied only when the page is added to homepage:

.standalone .yourElement {
    padding-top: 64px;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消