| 开发者 | demfilz |
|---|---|
| 更新时间 | 2026年10月13日 19:18 |
| PHP版本: | 7.2 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
[dpwa_install_button], plus a data-dpwa-install attribute or a dpwa-install CSS class (handy for menu items) for your own buttons.dpwa_manifest - filter the manifest array.dpwa_service_worker_config - filter the worker configuration (bypass and no-store patterns, cache limits, precache list).dpwa_bypass_patterns and dpwa_no_store_patterns - adjust the URL fragments the worker leaves alone or never stores.dpwa_script_config - filter the front-end configuration (banner, strings).dpwa_should_output - switch the manifest link, meta tags and script off for a request.window.dpwa.canInstall(), window.dpwa.promptInstall(), window.dpwa.showBanner(); events dpwa:installable, dpwa:installed and dpwa:dismissed on document, plus matching dataLayer pushes when a dataLayer exists./wp-content/plugins/demfilz-pwa, or install through the WordPress plugins screen.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.
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.
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.
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.
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.
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.
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.
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.
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.
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.