如何为Safari Web应用更改iOS状态栏的背景颜色?

10

我正在寻找一种方法来改变iOS状态栏的背景颜色,这是一个移动Web应用程序,我目前正在开发中。我看到了几个本地应用程序的解决方案,但如果可能的话,我需要适用于Safari和Chrome的解决方案。

我能找到的文档显示以下选项可用:

<meta name="apple-mobile-web-app-status-bar-style" content="default">

<meta name="apple-mobile-web-app-status-bar-style" content="black">

<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

有没有办法编辑元标记以使背景颜色为“#ff8000”?

是否有其他方法可以更改状态栏的背景颜色而不是编辑元标记?

感谢您的帮助!


你可能会发现这个链接有帮助:https://dev59.com/QnjZa4cB1Zd3GeqPgqgu - Stijn
2个回答

14

我刚刚偶然发现了这个问题,我的解决方案是将以下内容放在头部:

<meta name="theme-color" content="#ff8000" />

6

试试这个:

在你的index.html>head标签中使用以下内容:

<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

你还需要在styles.css文件中设置: body { background-color: #yourcolor } 上次我试过这个方案,它有效了。但别忘填写manifest.webmanifest文件中的相应信息。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接