[英]iOS web app not working offline in homescreen app, but working in Safari
I have a basic create-react-app
app that I tested on my iPhone 8 (through localhost).我有一个基本的
create-react-app
程序,我在我的 iPhone 8 上测试过(通过本地主机)。 The service worker registers properly when using Safari, but after adding the app to my homescreen and launching from there, the service worker doesn't work and I get the "Safari could not load the page because your iPhone is not connected to the internet" message. Service Worker 在使用 Safari 时正确注册,但是在将应用程序添加到我的主屏幕并从那里启动后,Service Worker 无法工作,我收到“Safari 无法加载页面,因为您的 iPhone 未连接到互联网”信息。 How can I fix this?
我怎样才能解决这个问题?
Fixed it!修复!
For some reason, service workers work through localhost on iOS, but have weird behaviour unless they are hosted on an HTTPS host.出于某种原因,服务工作者在 iOS 上通过 localhost 工作,但除非他们托管在 HTTPS 主机上,否则会有奇怪的行为。 I was able to fix this problem (and one other where an image wasn't loading after disappearing and reappearing) by hosting the production build on a DigitalOcean server.
通过在 DigitalOcean 服务器上托管生产版本,我能够解决这个问题(还有一个图像在消失和重新出现后没有加载的问题)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.