Why offline first?

Imagin you are visiting a website, it is fine if wifi connection is good. It might be also "fine" if show you "Your don't have internet connection", so you give up. The worse case is you have really poor wifi connection and the page is trying to loading, but nothing comes up. So you just wait and wait...

Noramlly online first soultion is trying to connect network (server) first. If cannot connect then fetch data from cache. This is not so good, because you still need to wait and wait util network fallback then you will get cache data. How about we do:

  1. When page loading, send two request.
  2. One request going to cache to fetch as much as we can to display on the screen.
  3. Another reqest going to the reall server, get data update.
  4. If we are in really poor wifi connection, at least we get something, we see something, better than nothing.
  5. If the connection is good, the cache data will be replaced with real data and interface update immediately. This will provide a better user experence.

[PWA] 0. Introduce to Offline First的更多相关文章

  1. how to use panda

    0.Introduce pandas.read_csv(filepath_or_buffer,sep=', ', dialect=None, compression='infer', doublequ ...

  2. Project Server 2016 部署

    问题: 手动创建网站集后,激活Project的功能时候报错 Only Administrator users can obtain the connection string for [Admin] ...

  3. Python黑帽编程 3.2 ARP监控

    Python黑帽编程 3.2 ARP监控 在第3.1节<ARP欺骗>中,我们学习了ARP的基本原理,使用Python实现了我们自己的ARP欺骗工具.在上一节的基础上,我们来实现一个ARP监 ...

  4. Python黑客编程ARP欺骗

    Python灰帽编程 3.1 ARP欺骗 ARP欺骗是一种在局域网中常用的攻击手段,目的是让局域网中指定的(或全部)的目标机器的数据包都通过攻击者主机进行转发,是实现中间人攻击的常用手段,从而实现数据 ...

  5. Python黑客编程基础3网络数据监听和过滤

    网络数据监听和过滤 课程的实验环境如下: •      操作系统:kali Linux 2.0 •      编程工具:Wing IDE •      Python版本:2.7.9 •      涉及 ...

  6. DedeCMSV57数据库结构文档

        表名:dede_addonarticle(ENGINE=MyISAM/CHARSET=gbk) 说明:Top 字段名 说明描述 具体参数 aid 文章ID mediumint(8) unsig ...

  7. Oracle - PL/SQL Commands

    第一章:日志管理 1.forcing log switches sql> alter system switch logfile; 2.forcing checkpoints sql> a ...

  8. 常用ASP函数的封装

    做ASP开发常常需要用到一些小功能,这些功能通常我们都会封装成函数来使用,本教程提供了许多我们经常用到的ASP函数. <% '所有功能函数名如下: ' StrLength(str) 取得字符串长 ...

  9. javascript版QQ在线聊天挂件

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. 无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型,原因为没有注册类

    错误描述 e = {"无法将类型为"System.__ComObject"的 COM 对象强制转换为接口类型"OpcRcw.Da.IOPCServer" ...

  2. Chrome 中的彩蛋——T-Rex

    今天,从网页上看到chrome的T-Rex的彩蛋,眨眼间完了10分钟.分享出来,只是好玩. 当 Chrome 无法连接到互联网时,或者上着网突然掉线,刷新页面时报错,我们都会看到T-Rex的身影,没错 ...

  3. JQuery jsonp使用小记

    在一个不支持PHP的主机上,需要对某些页面做访问统计.我的方案是在静态的HTML页面上,用JSONP向能够执行PHP的主机进行跨域请求,从而使用PHP解决这个访问量统计问题. 在服务器端,PHP页面返 ...

  4. Delphi中停靠技术的实现

    随着软件技术的不断进步,软件界面也越来越美观,操作也越来越方便.综观市面上比较专业的各种软件,我们会发现大部分都提供窗体停靠的功能,特别象工具软件,基本上都或多或少有停靠功能.自然,Delphi也支持 ...

  5. oracle 中使用触发器自动生成UUID

    create or replace trigger tri_test before insert on test for each row declare begin if :new.uuid is ...

  6. 总结iOS 8和Xcode 6的各种坑

    模拟器的路径从之前的~/Library/Application Support/iPhone Simulator移动到了~/Library/Developer/CoreSimulator/Device ...

  7. SSH:Connection closed by foreign host

    以为和防火墙,性能,HOSTS.DENY,端口之类的有关,后来查了下,啥都没有关系. 就是同一台机器NAT之后,被另一台抢了先机. http://blog.sina.com.cn/s/blog_6d0 ...

  8. IAR FOR ARM 7.2.2破解方法

    直接上图,注意选择"NO" 工具下载地址: http://download.csdn.net/detail/lan120576664/7604593 其实发现,该注册工具连IAR ...

  9. Inno Setup安装时不能关闭指定进程

    脚本由 Inno Setup 脚本向导 生成!; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! #define MyAppName "XX管理系统"#defi ...

  10. 16.缓存(Cache)

    如果每次进入页面的时候都查询数据库生成页面内容的话,如果访问量非常大,则网站性能会非常差.而如果只有第一次访问的时候才查询数据库生成页面内容,以后都直接输出内容,则能提高系统性能,这样无论有多少人访问 ...