问题标签 [progressive-web-apps]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
367 浏览

android - Android Chrome Beta - 来自主屏幕的启动画面

从主屏幕加载时,我的网站没有显示新的启动画面 ( https://developers.google.com/web/updates/2015/10/splashscreen ),尽管我链接了一个清单。因此我相信,我做了一个无效的清单。

这是 index.php 代码:

这是完整的 webappmanifest.json 代码:

0 投票
1 回答
760 浏览

javascript - 使用 Service Worker 预缓存静态文件

我正在尝试使用服务工作者预缓存我的一些静态应用程序外壳文件。我不能使用“sw-appcache”,因为我没有使用任何构建系统。但是,我尝试使用“sw-toolbox”,但无法将其用于预缓存。

这是我在服务工作者 JS 中所做的事情:

我也试过这个:

这是我的应用程序的 URL:https ://guidedverses-webapp-staging.herokuapp.com/ 这是我的服务工作者文件的 URL:https://guidedverses-webapp-staging.herokuapp.com/gdvs-sw。 js

我错过了什么?

0 投票
1 回答
554 浏览

web-applications - Serviceworker 缓存优先并在后台更新资源

我目前正在使用 Polymer 构建一个渐进式 Web 应用程序,它应该主要是一个原生应用程序。我已经创建了一个清单,但更重要的是,应用程序加载速度尽可能快。我想到了以下步骤:

一旦注册了 Serviceworker 并缓存了所有资源,我希望 Serviceworker 始终从缓存中加载资源,即使有互联网连接也是如此。在运行时,Web 应用程序应检查是否有任何新资源可用或是否已更改。如果是这样,请在后台下载它们,将它们保存在缓存中,以便下次加载 Web 应用程序时,它会使用新资源。

作为 serviceworker 和缓存的新手,任何建议、链接或想法都会受到高度赞赏!

0 投票
1 回答
1310 浏览

service-worker - 是否可以在没有 GCM 的情况下在 Chrome 中使用新的推送通知支持?

将新的 Push API 与 Service Worker 一起使用时,我可以使用 Google 的GCM以外的推送服务吗?

0 投票
1 回答
847 浏览

service-worker - 如何在本机和渐进式 Web 应用程序之间删除重复通知?

如果我有一个本地应用程序和一个渐进式网络应用程序,使用由服务工作者提供支持的网络推送通知,如果用户选择接收来自网站的通知并且还安装了应用程序,有没有办法防止用户接收重复的通知?

0 投票
2 回答
11730 浏览

javascript - 在 Google Chrome for Android 上调用 Javascript 通知 API 不能直接从网页工作

我正在使用 JavaScript Notification API 向我的用户显示一条小消息。它适用于我测试过的所有桌面浏览器,包括 Chrome ......但不适用于 Android 版 Chrome(至少是 KitKat)。我读到的所有内容都表明,Android Chrome 于 2015 年 4 月支持通知 API,该应用程序甚至具有通知权限设置......但是当我从其中调用 new Notification(...) 时没有任何反应。事实上,即使是官方的 Mozilla Notification API 演示页面也没有显示它们,尽管能够获取权限信息等。

为了使通知与 Android Chrome 兼容,我需要做些什么特别的事情吗?

0 投票
2 回答
491 浏览

android - What is the expected startup experience for a Progressive Web Application?

Testing a Progressive Web Application.

When I start the app in airplane mode, I get an unexpected startup/splash experience (Android/Chrome).

Launch from Home Screen Experience

I see a white screen, followed by a brief flash of the "offline dinosaur" before the app successfully starts and all is well. The startup time is longer than I expected, especially after testing with Chrome Devtools on a laptop, where startup is near instant.

Since it is a little tricky to debug where this time is being spent (especially in the “service-worker-not-running” case), it would be helpful to have some baseline knowledge:

Launch from Browser Experience

Just a brief flash of the "offline dinosaur" before the app successfully starts. Starts much faster.

Questions

  • What is the expected startup time and experience on Android/Chrome?
  • Is the experience described above just the current state of things (11/2015)?
  • Is there any way to specify the startup (splash) experience for Chrome? (I'm aware of background color and 144x144 icon in app manifest for splash, but for Opera only)

First time PWA for me, so any information on this would be helpful.

My platform: Samsung GS 5, Android 5.0, Chrome 46.0.2490.76

0 投票
1 回答
1588 浏览

javascript - Service Workers & Promises:未返回正确响应

在 Service Worker 中,我使用以下代码来测试外部 JavaScript 文件是否需要超过 500 毫秒才能返回。下面的代码还使用 Promise 竞争条件来确定网络是更快还是超时。如果超时获胜,那么我希望返回 408 响应。

我正在通过使用开发工具限制网络连接并强制它花费比设定的 500 毫秒更长的时间来测试这一点。

Chrome 开发工具

超时每次都会获胜并记录到控制台,这正是我所期望的。但是,它没有按预期返回 408,而是返回 200。有什么想法吗?

你可以在 Github 上看到一个这样的例子: https ://deanhume.github.io/Service-Workers-Fetch-Timeout/

和来源:

https://github.com/deanhume/Service-Workers-Fetch-Timeout/blob/gh-pages/service-worker.js

0 投票
2 回答
642 浏览

web-applications - Firefox 和 Chrome 应用程序清单的主要区别是什么

FF 和 Chrome 都开始支持使用应用清单和服务工作者的渐进式网络应用。

那么在编写清单时要记住的主要区别是什么(或者相同的清单文件可以在两者上工作)。

如果它是一个托管的 webapp(不是打包的),在让用户安装它的过程中有什么不同?

0 投票
2 回答
2321 浏览

service-worker - 如何在可能离线的 Progressive Web Apps 中使用 Google Analytics?

我的网站是一个离线工作的渐进式网络应用程序(单页/SPA)。

我想使用 Google Analytics,但不确定在这种情况下如何报告事件,尤其是因为设备可能处于离线状态。

有没有好的方法来做到这一点?