HTML5应用程序缓存机制介绍

对电脑常识了解的朋友都知道,浏览器网页存在缓存能够加速网页的展现,尤其是一些静态页面,缓存是有好处的。然后对于程序员来讲,有时候我们经常需要修改页面内容,因为有缓存,刚刚更改的内容不容易被及时展现出来,这时候程序员的常用操作就是强制刷新(CTRL+F5)。

什么是应用程序缓存?

HTML5 引入了应用程序缓存,这意味着 web 应用可进行缓存,并可在没有网络连接时进行访问。

应用程序缓存为应用带来三个优势:

应用程序缓存优势1.离线浏览 - 用户可在应用离线时使用它们(脱机浏览)

应用程序缓存优势2.速度 - 已缓存资源加载得更快

应用程序缓存优势3.减少服务器负载 - 浏览器将只从服务器下载更新过或更改过的资源。

HTML5如何启用应用程序缓存

如需启用应用程序缓存,请在文档的 标签中包含 manifest 属性:

……

应用程序缓存被更新的条件

一旦应用被缓存,它就会保持缓存直到发生下列情况:

用户清空浏览器缓存manifest 文件被修改(参阅下面的提示)由程序来更新应用缓存结语

取缓存的优点,摈弃缓存的不合适的地方,例如购票系统如果使用缓存,余票数量就不能很好的刷新,就不可取了。

http://www.wu0553.com/m/view.php?aid=37247
http://www.wu0553.com/m/view.php?aid=37250
http://www.wu0553.com/m/view.php?aid=37251
http://www.wu0553.com/m/view.php?aid=37253
http://www.wu0553.com/m/view.php?aid=37254
http://www.wu0553.com/m/view.php?aid=37256
http://www.wu0553.com/m/view.php?aid=37257
http://www.wu0553.com/m/view.php?aid=37259
http://www.wu0553.com/m/view.php?aid=37260
http://www.wu0553.com/m/view.php?aid=37261
http://www.wu0553.com/m/view.php?aid=37263
http://www.wu0553.com/m/view.php?aid=37267
http://www.wu0553.com/m/view.php?aid=37268
http://www.wu0553.com/m/view.php?aid=37322
http://www.wu0553.com/m/view.php?aid=37366
http://www.wu0553.com/m/view.php?aid=37370
http://www.wu0553.com/m/view.php?aid=37377
http://www.wu0553.com/m/view.php?aid=37395
http://www.wu0553.com/m/view.php?aid=37396
http://www.wu0553.com/m/view.php?aid=37397
http://www.wu0553.com/m/view.php?aid=37402
http://www.wu0553.com/m/view.php?aid=37403
http://www.wu0553.com/m/view.php?aid=37404
http://www.wu0553.com/m/view.php?aid=37405
http://www.wu0553.com/m/view.php?aid=37406
http://www.wu0553.com/m/view.php?aid=37407
http://www.wu0553.com/m/view.php?aid=37430
http://www.wu0553.com/m/view.php?aid=37431
http://www.wu0553.com/m/view.php?aid=37432
http://www.wu0553.com/m/view.php?aid=37433
http://www.wu0553.com/m/view.php?aid=37436
http://www.wu0553.com/m/view.php?aid=37441
http://www.wu0553.com/m/view.php?aid=37448
http://www.wu0553.com/m/view.php?aid=37454
http://www.wu0553.com/m/view.php?aid=37455
http://www.wu0553.com/m/view.php?aid=37465
http://www.wu0553.com/m/view.php?aid=37466
http://www.wu0553.com/m/view.php?aid=37467
http://www.wu0553.com/m/view.php?aid=37468
http://www.wu0553.com/m/view.php?aid=37469
http://www.wu0553.com/m/view.php?aid=37470
http://www.wu0553.com/m/view.php?aid=37471
http://www.wu0553.com/m/view.php?aid=37473
http://www.wu0553.com/m/view.php?aid=37474
http://www.wu0553.com/m/view.php?aid=37475
http://www.wu0553.com/m/view.php?aid=37476
http://www.wu0553.com/m/view.php?aid=37477
http://www.wu0553.com/m/view.php?aid=37478
http://www.wu0553.com/m/view.php?aid=37480
http://www.wu0553.com/m/view.php?aid=37481
http://www.wu0553.com/m/view.php?aid=37482
http://www.wu0553.com/m/view.php?aid=37483
http://www.wu0553.com/m/view.php?aid=37606
http://www.wu0553.com/m/view.php?aid=37609
http://www.wu0553.com/m/view.php?aid=37614
http://www.wu0553.com/m/view.php?aid=37616
http://www.wu0553.com/m/view.php?aid=37619
http://www.wu0553.com/m/view.php?aid=37623
http://www.wu0553.com/m/view.php?aid=37625
http://www.wu0553.com/m/view.php?aid=37628
http://www.wu0553.com/m/view.php?aid=37632
http://www.wu0553.com/m/view.php?aid=37635
http://www.wu0553.com/m/view.php?aid=37638
http://www.wu0553.com/m/view.php?aid=37640
http://www.wu0553.com/m/view.php?aid=37642
http://www.wu0553.com/m/view.php?aid=37654
http://www.wu0553.com/m/view.php?aid=37656
http://www.wu0553.com/m/view.php?aid=37658
http://www.wu0553.com/m/view.php?aid=37663
http://www.wu0553.com/m/view.php?aid=37665
http://www.wu0553.com/m/view.php?aid=37666
http://www.wu0553.com/m/view.php?aid=37667
http://www.wu0553.com/m/view.php?aid=37669
http://www.wu0553.com/m/view.php?aid=37670
http://www.wu0553.com/m/view.php?aid=37671
http://www.wu0553.com/m/view.php?aid=37672
http://www.wu0553.com/m/view.php?aid=37673
http://www.wu0553.com/m/view.php?aid=37674
http://www.wu0553.com/m/view.php?aid=37675
http://www.wu0553.com/m/view.php?aid=37677
http://www.wu0553.com/m/view.php?aid=37678
http://www.wu0553.com/m/view.php?aid=37679
http://www.wu0553.com/m/view.php?aid=37680
http://www.wu0553.com/m/view.php?aid=37681
http://www.wu0553.com/m/view.php?aid=37682
http://www.wu0553.com/m/view.php?aid=37683
http://www.wu0553.com/m/view.php?aid=37684
http://www.wu0553.com/m/view.php?aid=37688
http://www.wu0553.com/m/view.php?aid=37690
http://www.wu0553.com/m/view.php?aid=37694
http://www.wu0553.com/m/view.php?aid=37715
http://www.wu0553.com/m/view.php?aid=37716
http://www.wu0553.com/m/view.php?aid=37721
http://www.wu0553.com/m/view.php?aid=37724
http://www.wu0553.com/m/view.php?aid=37727
http://www.wu0553.com/m/view.php?aid=37729
http://www.wu0553.com/m/view.php?aid=37730
http://www.wu0553.com/m/view.php?aid=37731
http://www.wu0553.com/m/view.php?aid=37733

你可能感兴趣的:(HTML5应用程序缓存机制介绍)