Linux 软件免费装
Banner图

Demfilz PWA

开发者 demfilz
更新时间 2026年10月13日 19:18
PHP版本: 7.2 及以上
WordPress版本: 7.1
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

offline pwa progressive web app service worker add to home screen

下载

1.0.1

详情介绍:

Demfilz PWA makes your WordPress site a compliant Progressive Web App the moment you activate it. It serves a web app manifest and a service worker from your site root, generates the icon sizes browsers require, adds an offline page in your colours, and offers visitors an "Install" banner so they can add your site to their home screen or desktop. In plain terms: visitors can add your site to their home screen like an app. Pages they have already seen keep opening when they lose signal, and everything else shows a friendly offline page instead of a browser error. What you get Compatible with WooCommerce (cart, checkout and account pages are recognised automatically), page builders (edit modes are excluded from caching) and the common caching and minifying plugins (the front-end script is excluded from combine and minify bundles). Requirements Your site must be served over HTTPS for browsers to register the service worker and offer installation (localhost and 127.0.0.1 are exempt for testing). Your theme must be mobile-friendly, which every modern theme is; the Status panel checks this for you. Developer hooks

安装:

  1. Upload the plugin files to /wp-content/plugins/demfilz-pwa, or install through the WordPress plugins screen.
  2. Activate the plugin. Your site is installable straight away with the default settings.
  3. Go to Settings > PWA. Check the Status panel, then set your app name, short name, icon and colours.
  4. Open your site in Chrome, Edge or Samsung Internet on a phone or desktop: after you have interacted with a page the browser offers to install it, or the install banner appears after the configured number of page views. On iPhone and iPad the banner shows Add to Home Screen instructions instead.

屏幕截图:

  • App identity and appearance settings, with the icon picker.
  • The install banner on a phone.
  • The offline page in the site's colours.

升级注意事项:

1.0.1 Maintenance release; no settings change. 1.0.0 Initial release.

常见问题:

Does my site need HTTPS?

Yes. Browsers only register service workers and offer installation on secure origins. The Status panel and Site Health tell you if your site is not served over HTTPS. Localhost and 127.0.0.1 are exempt, which is handy for testing.

Where are the manifest and the service worker served from?

From your site root through WordPress: /dpwa-manifest.webmanifest, /dpwa-sw and /dpwa-offline. No files are written to your document root and no .htaccess changes are made. With plain permalinks the plugin switches to /?dpwa_manifest=1 style URLs automatically. The service worker URL has no .js extension on purpose, because some nginx configurations return 404 for missing static files instead of passing the request to WordPress.

Will logged-in users or WooCommerce customers see cached pages?

Personal pages are never stored. Responses that WordPress or WooCommerce mark as private or no-cache (every page served to a logged-in user, the cart, checkout and account pages) never enter the cache, and neither do search results, previews or anything under wp-admin. Form submissions and other non-GET requests are never handled by the worker at all. Public pages are fetched from the network first; the stored public copy is used only when the network fails or takes longer than the timeout in the settings (8 seconds by default), so on a very slow connection a visitor may briefly see the public version of a public page.

Why do I see the offline page for every page when I test?

Pages served to logged-in users are never stored, by design, so testing while logged in to WordPress shows the offline page for everything except pages stored in advance. Test in a private window, or log out first.

Which image should I use for the icon?

A square PNG or JPEG of at least 512 x 512 pixels with your logo or symbol filling most of the canvas. The plugin generates the 512, 192 and 180 pixel sizes and the maskable variants (your icon at 80% on the background colour). If you do not choose one, the Site Icon from Settings > General is used, and failing that a neutral placeholder.

Why does the install banner not appear?

The banner only appears when the browser reports that the site is installable, which needs HTTPS, the manifest, the icons and a registered service worker. Check the Status panel. Only Chrome, Edge and Samsung Internet report installability, and only after the visitor has tapped or clicked something on the page; Firefox never does, and desktop Safari offers File > Add to Dock without any signal to the page. The banner also waits for the configured number of page views and delay, is hidden once the app is installed, and stays hidden for the snooze period after a visitor chooses "Not now". Safari on iOS has no install prompt, so iPhone and iPad visitors get Add to Home Screen instructions instead.

Can I publish the app to Google Play or the Microsoft Store?

Yes, with PWABuilder (pwabuilder.com): give it your site address and it packages the manifest and service worker into store-ready apps. Add screenshots and categories under Settings > PWA first, as the stores use them for the listing.

I changed my theme or content. Do visitors get the new version?

Yes. Pages are network-first, so online visitors always receive fresh HTML. Scripts and styles are refreshed in the background and WordPress adds version query strings when plugins or themes update. Saving the PWA settings, or pressing Clear caches, publishes a new service worker version that drops every old cache on the visitor's next visit.

How do I add an install button to my menu or page?

Use the shortcode [dpwa_install_button text="Install app"], add the attribute data-dpwa-install to any link or button, or give a menu item the CSS class dpwa-install (Appearance > Menus > Screen Options > CSS Classes). The element stays hidden until the browser can install the site; on iOS it opens the Add to Home Screen instructions.

What happens when I deactivate the plugin?

The manifest, service worker and offline page URLs stop responding. Browsers unregister a service worker whose script URL returns a 404 at their next update check, so visitors drop back to plain browser behaviour on their own. Uninstalling also removes the settings and the generated icon files.

更新日志:

1.0.1 1.0.0