简体   繁体   English

如何在iPhone上预览Web应用程序设计并使其看起来像本机应用程序?

[英]How can I preview a web app design on an iPhone and make it look like a native application?

I'm hardcoding a web application using HTML, SCSS, JS, and Rails to preview the design for an application I'm working on. 我正在使用HTML,SCSS,JS和Rails对Web应用程序进行硬编码,以预览我正在处理的应用程序的设计。 I'm want to preview the design on my iPhone but I want to make it look like a native app. 我想在我的iPhone上预览设计,但我想让它看起来像一个原生应用程序。 In other words "no Safari navbar or footer". 换句话说“没有Safari导航栏或页脚”。

I'm running localhost on my MacBook then I used the IP address to preview it on my iPhone using Safari. 我在MacBook上运行localhost然后我使用IP地址在我的iPhone上使用Safari进行预览。

  1. I've added the following meta tags 我添加了以下元标记
  2. Added the web app to the iPhone's home screen "Add to Home Screen" 将Web应用程序添加到iPhone的主屏幕“添加到主屏幕”
  3. Launched the web application by clicking on the icon that's now on the iPhone's home screen and I still see the navbar and footer. 通过单击iPhone主屏幕上现在的图标启动Web应用程序,我仍然可以看到导航栏和页脚。

If this helps, the top-level container is set to 100% height and there is no scrolling on the homepage. 如果这有帮助,顶级容器设置为100%高度,并且主页上没有滚动。

   <meta name="apple-touch-fullscreen" content="yes" />
   <meta name="apple-mobile-web-app-capable" content="yes" />
   <meta name="apple-mobile-web-app-status-bar-style" content="black" />

To do so you should add your website to the home screen . 为此,您应该将您的网站添加到主屏幕

And then open it as a native application (go to home screen and tap on the application icon). 然后将其作为本机应用程序打开(转到主屏幕并点击应用程序图标)。

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM