[WordPress] 外掛分享: PWA

WordPress 外掛 PWA 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「PWA」是 2018-07-11 上架。
  • 目前有 30000 個安裝啟用數。
  • 上一次更新是 2025-04-10,距離現在已有 24 天。
  • 外掛最低要求 WordPress 6.6 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.2 以上。
  • 有 27 人給過評分。
  • 論壇上目前有 2 個提問,問題解答率 50%

外掛協作開發者

xwp | google | rtcamp | westonruter | albertomedina |

外掛標籤

pwa | service-workers. | web app manifest | progressive web apps |

內容簡介

進階網頁應用程式(Progressive Web Apps)是一種擁有網頁使用者體驗的技術,其特點包括:

可靠 – 可在不確定的網路狀況下,即時加載而不會顯示網頁無法訪問的訊息。
快速 - 能迅速回應用戶的操作,並提供流暢的動畫效果和無卡頓的滾動體驗。
引人入勝 - 在使用者的裝置上具有自然而然的應用程式感受,提供豐富的使用者體驗。

這種新的使用體驗讓進階網頁應用程式能夠放置在使用者的主屏幕上。欲知更多關於Google進階網頁應用程式的相關資訊,請查閱Progressive Web Apps (PWA)。

一般來說,要支援進階網頁應用程式需要以下技術支援:

Service Workers
Web App Manifest
HTTPS

這個WordPress外掛程式提供了在WordPress中實現這些功能的支援,以便進一步合併到核心中。例如,這個插件中的HTTPS功能已大部分納入WordPress核心:在WordPress 5.7中改進的HTTPS檢測和遷移。

這個功能插件不是用來取代其他將WordPress網站轉換成進階網頁應用程式的插件和主題,而是旨在為這些主題和插件提供PWA的基本構建和協同機制,以避免重複建置和衝突。例如,實現應用外殼模式的主題應該能夠擴展核心服務工作者,而提供推送通知的插件也應該能夠這樣做。主題和插件不再需要各自創建自己的服務工作者,這本質上是有問題的,因為只能有一個服務工作者處於活動狀態:只有一個服務工作者能勝出。如果您正在開發包含服務工作者的插件或主題,請考慮依賴此PWA插件,或至少在PWA插件不可用時只使用內置實現作為後備措施。

在0.6版本之前,預設情況下不會添加任何緩存策略。服務工作者的唯一行為是在客戶端連接斷開或網站停止運行時提供離線模板,並在伺服器返回500 Internal Server Error時提供錯誤頁面。從0.6版本開始,管理介面的閱讀設定屏幕上新增了一個“離線瀏覽”切換選項。預設情況下,它是禁用的,但啟用後會為導航註冊一個基於網路的緩存策略,以便在訪問先前訪問過的頁面時不會顯示離線頁面。這個基於網路的策略也用於主題、插件和WordPress核心的資產。此外,上傳的圖像會使用更新時重獲更新策略提供服務。有關這些變更的詳細信息,請參閱拉取請求。此插件的文檔可以在以下位置找到:

原文外掛簡介

Progressive Web Apps are user experiences that have the reach of the web, and are:

Reliable – Load instantly and never show the downasaur, even in uncertain network conditions.
Fast – Respond quickly to user interactions with silky smooth animations and no janky scrolling.
Engaging – Feel like a natural app on the device, with an immersive user experience.

This new level of quality allows Progressive Web Apps to earn a place on the user’s home screen.

Continue reading more about Progressive Web Apps (PWA) from Google.
In general a PWA depends on the following technologies to be available:

Service Workers
Web App Manifest
HTTPS

This plugin serves as a place to implement support for these in WordPress with the intention of being proposed for core merge, piece by piece. Case in point, the HTTPS functionality from this plugin has largely been made part of Core: Improved HTTPS detection and migration in WordPress 5.7.
This feature plugin is not intended to obsolete the other plugins and themes which turn WordPress sites into PWAs. Rather, this plugin is intended to provide the PWA building blocks and coordination mechanism for these themes and plugins to not reinvent the wheel and also to not conflict with each other. For example, a theme that implements the app shell model should be able to extend the core service worker while a plugin that provides push notifications should be able to do the same. Themes and plugins no longer should have to each create a service worker on their own, something which is inherently problematic because only one service worker can be active at a time: only one service worker can win. If you are developing a plugin or theme that includes a service worker, consider relying on this PWA plugin, or at least only use the built-in implementation as a fallback for when the PWA plugin is not available.
In versions prior to 0.6, no caching strategies were added by default. The only service worker behavior was to serve an offline template when the client’s connection is down or the site is down, and also to serve an error page when the server returns with 500 Internal Server Error. As of 0.6, there is a new “Offline browsing” toggle on the Reading Settings screen in the admin. It is disabled by default, but when enabled a network-first caching strategy is registered for navigations so that the offline page won’t be shown when accessing previously-accessed pages. The network-first strategy is also used for assets from themes, plugins, and WordPress core. In addition, uploaded images get served with a stale-while-revalidate strategy. For all the details on these changes, see the pull request.
Documentation for the plugin can be found on the GitHub project Wiki.
Development of this plugin is done on GitHub. Pull requests welcome. Please see issues reported there before going to the plugin forum.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「PWA」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1.0 | 0.2.0 | 0.3.0 | 0.4.0 | 0.5.0 | 0.6.0 | 0.7.0 | 0.7.1 | 0.8.0 | 0.8.1 | 0.8.2 | trunk |

延伸相關外掛(你可能也想知道)

  • Offline Content 》這個外掛使用新的 ServiceWorker 和 Cache API,讓您的使用者在離線或網路不穩定時,透過緩存您網站的一部分,仍能瀏覽您的網站內容。, 安裝此外掛後,只要使...。
  • Offline Pre-Cache 》離線預緩存外掛使用 Google 提供的 Workbox 库來提供 PWA。訪客端會將您的網站快取,使網頁載入速度更快,也可以離線使用。, 離線預緩存的主要功能包括:, , ...。

文章
Filter
Mastodon