SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Progressive Web Apps
入门分享
PWA 是什么?
– Shelwon
“利用现代 Web 新技术以尝试在移动设备上提供
接近 Native App 体验的 Web Apps”
线上例子
Flipkart
离线?
PWA 的特性
• 体验流畅 - 接近 Native App 的交互和体验
• 安全 - 强制使用 HTTPS 来通信
• 利于 SEO - manifest 可以让搜索引擎更好地发现应
用
• 便于分享 - 通过 Url 就可以轻松分享
• 可安装 - 添加图标到主屏幕
• 离线运行 - 没有网络和网速差的条件仍然可以提供访
问
• 推送消息 - 像 Native App 那样收到消息推送
• 持续更新- 可以悄悄地在后台更新应用数据
如何升级到 PWA
早在 Chrome 31 的时候
没有网络的时候
半成品
The Web App Manifest
• short_name:PWA 图标被添加到主屏幕时候显示的名字(类似主屏幕上
Native App 的名字)
• name: PWA 启动时的标题。
• icons:PWA 图标
• start_url:定义了 PWA 的入口页面。比如开发者把这个属性设为 Flipkart
Lite 的商品列表页,那么从主屏打开就是 Flipkart Lite 的商品列表页。
• theme_color/background_color:主题色与背景色,用于配置一些可定制的
操作系统 UI 以提高用户体验,比如 Android 的状态栏、任务栏等。
• display:设置你的 PWA 启动时是全屏还是像在浏览器那样有顶部导航栏。
• orientation:设置 PWA 启动时候是横屏还是竖屏。
Service Worker
– MDN CN
“充当位于 Web 应用程序之间,以及浏览器和网
络的代理服务器。它的存在是为了能够创建有效
的离线体验,拦截网络请求并且可以根据网络是
否可用以及是否去服务器获取页面更新而做出不
同的响应。”
SW初次安装的生命周期
• 假如这个 SW 已经注册过,上面代码会被忽略
• sw.js 根据需要放在不同层级的目录(./sw.js 和
./demo/sw.js 作用域不一样)
• chrome://inspect/#service-workers 检查是否生效
Web Push &
Notification API
Web Storage
• Cache API - PWA 页面所需的静态文件比如
JavaScript、CSS 和 HTML
• IndexedDB - 存储页面数据,比如电商 PWA 的列表
页或者商品详情页的数据。
More Amazing Web
API
• Payment Request API
• Geolocation API
• Device Orientation & Motion API
• getUserMedia
展望 PWA 的未来
黯淡的现状
• iOS (safari) 不支持 PWA
• 国内 Android 设备支持程度堪忧
• 国产移动浏览器厂商支持欲望不足
• Chrome 浏览器只认自家的 GCM
• 国内 webview 环境复杂,比如微信
进步的现在
• Webkit 内核:API 开发在「五年计划」中
• EdgeHTML 内核:关键技术都在「正在开发中」
• Blink 内核和 Gecko 内核:全部实现
想了解更多?
参考链接
• PWA 官网:
https://developers.google.com/web/fundamentals/g
etting-started/codelabs/your-first-pwapp/?hl=zh-cn
• 一系列 PWA 应用集合展示:https://pwa.rocks/
• 介绍 PWA 的精品文章:
https://zhuanlan.zhihu.com/p/25167289
Q&A

Weitere ähnliche Inhalte

Andere mochten auch

Getting Started with Progressive Web Apps
Getting Started with Progressive Web AppsGetting Started with Progressive Web Apps
Getting Started with Progressive Web AppsBill Stavroulakis
 
Progressive Web Apps [pt_BR]
Progressive Web Apps [pt_BR]Progressive Web Apps [pt_BR]
Progressive Web Apps [pt_BR]Evandro Santos
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...Robert Nyman
 
Progressive web apps with Angular 2
Progressive web apps with Angular 2Progressive web apps with Angular 2
Progressive web apps with Angular 2Manfred Steyer
 
Progressive web apps
Progressive web apps Progressive web apps
Progressive web apps Biko
 
Building a Progressive Web App
Building a  Progressive Web AppBuilding a  Progressive Web App
Building a Progressive Web AppIdo Green
 
From AMP to PWA
From AMP to PWAFrom AMP to PWA
From AMP to PWAIdo Green
 
PWA 與 Service Worker
PWA 與 Service WorkerPWA 與 Service Worker
PWA 與 Service WorkerAnna Su
 
“How can we face Facebook?”
“How can we face Facebook?”“How can we face Facebook?”
“How can we face Facebook?”Coreconsulting
 
San Diego Daily Transcript - PR Newswire Event July 2009
San Diego Daily Transcript - PR Newswire Event July 2009San Diego Daily Transcript - PR Newswire Event July 2009
San Diego Daily Transcript - PR Newswire Event July 2009Michael Pranikoff
 
The Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web AppThe Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web AppChristopher Nguyen
 
Demystifying progressive web apps
Demystifying progressive web appsDemystifying progressive web apps
Demystifying progressive web appsMarcus Hellberg
 
Progressive Web Apps - Lightning Talk
Progressive Web Apps - Lightning TalkProgressive Web Apps - Lightning Talk
Progressive Web Apps - Lightning TalkTimmy Kokke
 
Progressive Web Apps - Porque nativo no es significa mejor
Progressive Web Apps - Porque nativo no es significa mejorProgressive Web Apps - Porque nativo no es significa mejor
Progressive Web Apps - Porque nativo no es significa mejorIsrael Blancas
 
Building Progressive Web Apps (Kyle Buchanan)
Building Progressive Web Apps (Kyle Buchanan)Building Progressive Web Apps (Kyle Buchanan)
Building Progressive Web Apps (Kyle Buchanan)Red Hat Developers
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Appsjungkees
 
Progressive Web Apps (español - spanish)
Progressive Web Apps (español - spanish)Progressive Web Apps (español - spanish)
Progressive Web Apps (español - spanish)Maximiliano Firtman
 

Andere mochten auch (20)

Getting Started with Progressive Web Apps
Getting Started with Progressive Web AppsGetting Started with Progressive Web Apps
Getting Started with Progressive Web Apps
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web apps
 
Progressive Web Apps [pt_BR]
Progressive Web Apps [pt_BR]Progressive Web Apps [pt_BR]
Progressive Web Apps [pt_BR]
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
 
Progressive web apps with Angular 2
Progressive web apps with Angular 2Progressive web apps with Angular 2
Progressive web apps with Angular 2
 
Progressive web apps
Progressive web apps Progressive web apps
Progressive web apps
 
Building a Progressive Web App
Building a  Progressive Web AppBuilding a  Progressive Web App
Building a Progressive Web App
 
From AMP to PWA
From AMP to PWAFrom AMP to PWA
From AMP to PWA
 
PWA 與 Service Worker
PWA 與 Service WorkerPWA 與 Service Worker
PWA 與 Service Worker
 
“How can we face Facebook?”
“How can we face Facebook?”“How can we face Facebook?”
“How can we face Facebook?”
 
San Diego Daily Transcript - PR Newswire Event July 2009
San Diego Daily Transcript - PR Newswire Event July 2009San Diego Daily Transcript - PR Newswire Event July 2009
San Diego Daily Transcript - PR Newswire Event July 2009
 
The Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web AppThe Hitchhiker's Guide to Building a Progressive Web App
The Hitchhiker's Guide to Building a Progressive Web App
 
Demystifying progressive web apps
Demystifying progressive web appsDemystifying progressive web apps
Demystifying progressive web apps
 
Progressive Web Apps - Lightning Talk
Progressive Web Apps - Lightning TalkProgressive Web Apps - Lightning Talk
Progressive Web Apps - Lightning Talk
 
Progressive Web Apps - NPD Meet
Progressive Web Apps - NPD MeetProgressive Web Apps - NPD Meet
Progressive Web Apps - NPD Meet
 
Introducción a las Progressive web apps
Introducción a las Progressive web appsIntroducción a las Progressive web apps
Introducción a las Progressive web apps
 
Progressive Web Apps - Porque nativo no es significa mejor
Progressive Web Apps - Porque nativo no es significa mejorProgressive Web Apps - Porque nativo no es significa mejor
Progressive Web Apps - Porque nativo no es significa mejor
 
Building Progressive Web Apps (Kyle Buchanan)
Building Progressive Web Apps (Kyle Buchanan)Building Progressive Web Apps (Kyle Buchanan)
Building Progressive Web Apps (Kyle Buchanan)
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Progressive Web Apps (español - spanish)
Progressive Web Apps (español - spanish)Progressive Web Apps (español - spanish)
Progressive Web Apps (español - spanish)
 

Ähnlich wie PWA 101

IDF2013大会分享——《使用新浪移动云开发全平台应用》
IDF2013大会分享——《使用新浪移动云开发全平台应用》IDF2013大会分享——《使用新浪移动云开发全平台应用》
IDF2013大会分享——《使用新浪移动云开发全平台应用》easychen
 
Windows Phone 7 in azure
Windows Phone 7 in azureWindows Phone 7 in azure
Windows Phone 7 in azureTao Wang
 
Service Integration Workshop
Service Integration WorkshopService Integration Workshop
Service Integration WorkshopRyan Chung
 
Enterprise connect
Enterprise connectEnterprise connect
Enterprise connectthinkinlamp
 
快!快!快! 互联网第一条军规
快!快!快! 互联网第一条军规快!快!快! 互联网第一条军规
快!快!快! 互联网第一条军规yangdj
 
Webify 一键部署
Webify 一键部署Webify 一键部署
Webify 一键部署琦 胡
 
千万级并发在线推送系统架构解析 | 个信互动 叶新江
千万级并发在线推送系统架构解析 | 个信互动 叶新江千万级并发在线推送系统架构解析 | 个信互动 叶新江
千万级并发在线推送系统架构解析 | 个信互动 叶新江imShining @DevCamp
 
陈子舜-Html5 based web app
陈子舜-Html5 based web app陈子舜-Html5 based web app
陈子舜-Html5 based web appWebrebuild
 
使用GoogleAppEngine建立个人信息中心
使用GoogleAppEngine建立个人信息中心使用GoogleAppEngine建立个人信息中心
使用GoogleAppEngine建立个人信息中心Du Yamin
 
陈敏简历Java软件工程师
陈敏简历Java软件工程师陈敏简历Java软件工程师
陈敏简历Java软件工程师guestb12ca4
 
Appium手机自动化测试 testerhome_bqcon版本
Appium手机自动化测试 testerhome_bqcon版本Appium手机自动化测试 testerhome_bqcon版本
Appium手机自动化测试 testerhome_bqcon版本延胜 黄
 
行動與雲端科技在圖書館的應用
行動與雲端科技在圖書館的應用行動與雲端科技在圖書館的應用
行動與雲端科技在圖書館的應用皓仁 柯
 
Network security reesjohnson
Network security reesjohnsonNetwork security reesjohnson
Network security reesjohnsonITband
 
2009-05 ShareTech Aw Lb
2009-05  ShareTech Aw Lb2009-05  ShareTech Aw Lb
2009-05 ShareTech Aw Lbpeter
 
一步一步开发Html5 mobile apps
一步一步开发Html5 mobile apps一步一步开发Html5 mobile apps
一步一步开发Html5 mobile appsAdam Lu
 
20170108 微軟大數據整合解決方案- cortana intelligence suite
20170108 微軟大數據整合解決方案- cortana intelligence suite20170108 微軟大數據整合解決方案- cortana intelligence suite
20170108 微軟大數據整合解決方案- cortana intelligence suiteMeng-Ru (Raymond) Tsai
 
Appcan介绍自己的应用开发平台
Appcan介绍自己的应用开发平台Appcan介绍自己的应用开发平台
Appcan介绍自己的应用开发平台MOBINODE
 
Appcan移动应用开发平台介绍120409
Appcan移动应用开发平台介绍120409Appcan移动应用开发平台介绍120409
Appcan移动应用开发平台介绍120409zhengyiwuxian
 
移动社交网络动态框架 李章晶
移动社交网络动态框架 李章晶移动社交网络动态框架 李章晶
移动社交网络动态框架 李章晶Shaoning Pan
 

Ähnlich wie PWA 101 (20)

IDF2013大会分享——《使用新浪移动云开发全平台应用》
IDF2013大会分享——《使用新浪移动云开发全平台应用》IDF2013大会分享——《使用新浪移动云开发全平台应用》
IDF2013大会分享——《使用新浪移动云开发全平台应用》
 
Windows Phone 7 in azure
Windows Phone 7 in azureWindows Phone 7 in azure
Windows Phone 7 in azure
 
Service Integration Workshop
Service Integration WorkshopService Integration Workshop
Service Integration Workshop
 
雲端技術的新趨勢
雲端技術的新趨勢雲端技術的新趨勢
雲端技術的新趨勢
 
Enterprise connect
Enterprise connectEnterprise connect
Enterprise connect
 
快!快!快! 互联网第一条军规
快!快!快! 互联网第一条军规快!快!快! 互联网第一条军规
快!快!快! 互联网第一条军规
 
Webify 一键部署
Webify 一键部署Webify 一键部署
Webify 一键部署
 
千万级并发在线推送系统架构解析 | 个信互动 叶新江
千万级并发在线推送系统架构解析 | 个信互动 叶新江千万级并发在线推送系统架构解析 | 个信互动 叶新江
千万级并发在线推送系统架构解析 | 个信互动 叶新江
 
陈子舜-Html5 based web app
陈子舜-Html5 based web app陈子舜-Html5 based web app
陈子舜-Html5 based web app
 
使用GoogleAppEngine建立个人信息中心
使用GoogleAppEngine建立个人信息中心使用GoogleAppEngine建立个人信息中心
使用GoogleAppEngine建立个人信息中心
 
陈敏简历Java软件工程师
陈敏简历Java软件工程师陈敏简历Java软件工程师
陈敏简历Java软件工程师
 
Appium手机自动化测试 testerhome_bqcon版本
Appium手机自动化测试 testerhome_bqcon版本Appium手机自动化测试 testerhome_bqcon版本
Appium手机自动化测试 testerhome_bqcon版本
 
行動與雲端科技在圖書館的應用
行動與雲端科技在圖書館的應用行動與雲端科技在圖書館的應用
行動與雲端科技在圖書館的應用
 
Network security reesjohnson
Network security reesjohnsonNetwork security reesjohnson
Network security reesjohnson
 
2009-05 ShareTech Aw Lb
2009-05  ShareTech Aw Lb2009-05  ShareTech Aw Lb
2009-05 ShareTech Aw Lb
 
一步一步开发Html5 mobile apps
一步一步开发Html5 mobile apps一步一步开发Html5 mobile apps
一步一步开发Html5 mobile apps
 
20170108 微軟大數據整合解決方案- cortana intelligence suite
20170108 微軟大數據整合解決方案- cortana intelligence suite20170108 微軟大數據整合解決方案- cortana intelligence suite
20170108 微軟大數據整合解決方案- cortana intelligence suite
 
Appcan介绍自己的应用开发平台
Appcan介绍自己的应用开发平台Appcan介绍自己的应用开发平台
Appcan介绍自己的应用开发平台
 
Appcan移动应用开发平台介绍120409
Appcan移动应用开发平台介绍120409Appcan移动应用开发平台介绍120409
Appcan移动应用开发平台介绍120409
 
移动社交网络动态框架 李章晶
移动社交网络动态框架 李章晶移动社交网络动态框架 李章晶
移动社交网络动态框架 李章晶
 

PWA 101