本文介绍了离子3发布应用程序作为PWA(Progressive Web App)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的应用程序发布为PWA所以我所做的是

I want to publish my app as PWA so what i did is

将此脚本插入index.html

insert this script to index.html

<!--script>
    if ('serviceWorker' in navigator) {
      navigator.serviceWorker.register('service-worker.js')
        .then(() => console.log('service worker installed'))
        .catch(err => console.log('Error', err));
    }
</script-->

然后安装

npm run ionic:build --prod

它看起来像部署它但我的问题是:

it looks like it deploy it but my questions are:


  1. 我需要将哪些文件上传到主机以将应用程序发布为PWA?

  2. 为什么当我在应用程序中更改某些内容并运行离子服务时,没有任何更改,它只在WWW文件夹的index.html中更改?为什么?(因为现在是PWA?)

  1. what files I need to upload to host for publish the app as PWA?
  2. why when I change something in the app and run ionic serve nothing changed and it changed only in the index.html of the WWW folder? why?(because now it's PWA??)

当我打开www文件夹时,当我按下打开警告对话框的按钮时我运行打开index.html不开放。为什么?

when I open www folder and I run open index.html when i press on button that open alert dialog it not open that. why?


推荐答案

运行

离子cordova平台添加浏览器

离子构建浏览器 - prod --release

然后转到 [project_folder] / platforms / browser / www 并在您的http服务器上复制内容。

Then go to [project_folder]/platforms/browser/www and copy the content at you http server.

这篇关于离子3发布应用程序作为PWA(Progressive Web App)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 11:55