Knowledge

Cache manifest in HTML5

Source 📝

243:, which can be updated regularly by the author of the web application, indicating any new web addresses that are added or deleted. When connecting to a network for the first time, a web browser will read the HTML5 manifest file, download the resources given and store them locally. Then, in the absence of a network connection, the web browser will shift to the local copies instead and render the web application offline. 36: 251:
In order for the offline applications to work, a cache manifest file must be created by the web developer. If the web application exceeds more than one page then each page must have a manifest attribute that points to the cache manifest. Every page referencing the manifest will be stored locally. The
507:
This manifest file lists three resources: a CSS file, a JavaScript file and a PNG image. When the above file is loaded, the browser will download the test.css, test.js and test.png files from the root directory in the web server. As a result, whenever one's network is not connected, the resources
557:
This example consists of headers. The line, NETWORK: is the start of the "online whitelist" section. The resources listed under this section are never cached and are not available offline. As a result, an error will occur when an attempt is made offline to load the resource.
211:
Web applications consist of web pages that need to be downloaded from a network. For this to happen there must be a network connection. However, there are many instances when users cannot connect to a network due to circumstances beyond their control.
186:
Since 2021, this technology is no longer widely available. It was removed from Firefox 85, and disabled by default in Chrome 84 and removed in Chrome 95. Using any of the offline Web application features at this time is highly discouraged and use of
661:
If an error occurs at any instance in the above events, the browser will trigger an error event and stop the process. Given below are a few errors that can occur when re-downloading resources.
739: 329:
will contain the list of resources (i.e., test.js, test.css) needed for this web page to work offline. Common names for this file are cache.manifest and manifest.appcache.
588:) before ‘offline’ will match any URL pattern on one's site. If the browser does not find the page in the appcache, the application will display the page /offline.html. 561:
There is a shift to the explicit section by the header CACHE: and the resources (the CSS stylesheet, JavaScript and the image file) can be downloaded and used offline.
984: 1028: 1019: 603:
If the browser visits a web page, has NOT seen the web page before and as a result does not recognize the manifest file, the following events will ensue.
797: 569:
The fallback section in a cache manifest file can be used to substitute online resources that cannot be cached or were not cached successfully.
926: 747: 541:
Note: Example 1 and Example 2 above, do not indicate any section header and are therefore considered an explicit section by default.
657:
Event - after the re-downloading is complete, this event is triggered, indicating that the new offline version is ready to be used.
54: 239:, images or any other source that is required for a web application to be rendered. Their addresses can be copied into a 651:
Event - this contains information of how many files have been downloaded and how many files are left to be downloaded.
628:
Event - occurs once all the files have been downloaded and the offline web application is equipped to be used offline.
519:
CACHE MANIFEST /main/features.js /main/settings/index.css http://files/images/scene.jpg http://files/images/world.jpg
21: 992: 1053: 632:
If the browser has visited the web page before and recognizes the manifest file the following events will ensue.
622:
Event - contains information of how many files have been downloaded and how many files are left to be downloaded.
112: 1016: 776: 610:
Event - occurs when the browser visits a web page and reads the manifest attribute on the <html> element.
224: 192: 16:
This article is about obsolete technology for making web pages accessible offline. For regular HTTP cache, see
252:
cache manifest file is a text file located in another part of the server. It must be served with content type
892: 805: 64:
into an encyclopedic article, please do so and remove this message and/or add a link to the Wikibook using
959: 232: 119: 188: 199:
technology, and as of 2023 is currently active and going through the standardization process at the
196: 35: 1038: 85: 68: 216:
provides the ability to access the web application even without a network connection using the
148: 934: 851: 322:
The argument to the manifest attribute is a relative or absolute path to the manifest file.
132: 678:
The cache manifest was changed but the browser did not download a resource in the manifest.
645:
Event - if the cache manifest has changed the resources the files will be downloaded again.
1033: 1023: 176: 1058: 693: 61: 1047: 717: 240: 325:
Consider the HTML file given below. The <html> element indicates a file named
826: 511:
Cache manifests can also use relative paths or even absolute URLs as shown below.
236: 97: 698: 554:
CACHE MANIFEST NETWORK: /checking.cgi CACHE: /test.css /test.js /test.png
217: 50: 17: 46: 666: 616:
Event - it will download all the resources given in the manifest file.
175:
was a software storage feature which provided the ability to access a
740:"Using the application cache - HTML: HyperText Markup Language | MDN" 768: 580:
In Example 4, the fallback section consists of a single line. i.e.,
639:
Event - this will take place if the cache manifest has not changed.
688: 213: 124: 228: 672:
Failure to download the HTML page that pointed to the manifest.
266:
element in order for the cache manifest file to work. Example:
200: 180: 29: 527:
The cache manifest file consists of three section headers.
898: 191:
is recommended instead. Cache manifests are distinct from
179:
even without a network connection. It became part of the
20:. For modern technology for creating offline apps, see 718:"Application cache as part of the W3C Recommendation" 675:
The cache manifest changed while the update occurred.
577:
CACHE MANIFEST FALLBACK: / /offline.html NETWORK: …
496:
Given below is an example of a cache manifest file.
223:
Web applications consist of resources identified by
852:"A Beginner's Guide to Using the Application Cache" 143: 130: 118: 108: 96: 84: 534:Online whitelist section with the header NETWORK. 545:Online whitelist section with the header NETWORK 195:, a JSON-based file format which is part of the 504:CACHE MANIFEST /test.css /test.js /test.png 8: 669:) or Page Permanently Gone (HTTP error 410). 537:Fallback section with the header FALLBACK. 565:Fallback section with the header FALLBACK 1017:Using the application cache - HTML | MDN 709: 531:Explicit section with the header CACHE. 886: 884: 882: 880: 878: 876: 874: 872: 870: 868: 493:, spaces and blank lines are ignored. 81: 954: 952: 7: 921: 919: 917: 915: 508:will be available to them offline. 183:Recommendation on 28 October 2014. 1029:HTML5: Offline Application Caching 850:Bidelman, Eric (29 October 2013). 14: 769:"Preparing for AppCache removal" 34: 779:from the original on 2020-05-20 485:file must start with the line 1: 1039:Alistapart: Application Cache 897:. O'Reilley. Archived from 454:Testing the manifest file. 22:Progressive web application 1075: 827:"Web Application Manifest" 352:"cache.appcache" 286:"cache.appcache" 15: 804:. Mozilla. Archived from 798:"Window.applicationCache" 193:web application manifests 113:World Wide Web Consortium 27:Local cache in a web file 584:. The single character ( 489:. Comments start with a 334:<!—- test.html --> 331: 268: 98:Internet media type 260:manifest="<path>" 173:cache manifest in HTML5 55:Cache manifest in HTML5 891:Pilgrim, Mark (2010). 422:"stylesheet" 744:developer.mozilla.org 596:Events are under the 337:<!DOCTYPE HTML> 271:<!DOCTYPE HTML> 262:must be added to the 927:"W3 HTML5 Manifests" 894:HTML5 Up and Running 431:"test.css" 60:If this page can be 937:on 24 December 2010 600:JavaScript object. 398:"test.js" 254:text/cache-manifest 197:progressive web app 103:text/cache-manifest 1022:2019-02-15 at the 86:Filename extension 1054:Cache (computing) 720:. 28 October 2014 169: 168: 109:Developed by 80: 79: 1066: 1005: 1004: 1002: 1000: 995:on 14 April 2011 991:. Archived from 981: 975: 974: 972: 970: 956: 947: 946: 944: 942: 933:. Archived from 923: 910: 909: 907: 906: 888: 863: 862: 860: 858: 847: 841: 840: 838: 837: 823: 817: 816: 814: 813: 794: 788: 787: 785: 784: 765: 759: 758: 756: 755: 746:. Archived from 736: 730: 729: 727: 725: 714: 665:Page Not Found ( 656: 650: 644: 638: 627: 621: 615: 609: 599: 598:ApplicationCache 492: 488: 472: 469: 466: 463: 460: 457: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 423: 420: 417: 414: 411: 408: 405: 402: 399: 396: 393: 390: 387: 384: 381: 378: 374: 371: 368: 365: 362: 359: 356: 353: 350: 347: 344: 341: 338: 335: 318: 315: 312: 309: 306: 303: 299: 296: 293: 290: 287: 284: 281: 278: 275: 272: 261: 255: 165: 162: 160: 158: 156: 154: 152: 150: 136: 82: 75: 73: 67: 38: 30: 1074: 1073: 1069: 1068: 1067: 1065: 1064: 1063: 1044: 1043: 1024:Wayback Machine 1013: 1008: 998: 996: 983: 982: 978: 968: 966: 958: 957: 950: 940: 938: 925: 924: 913: 904: 902: 890: 889: 866: 856: 854: 849: 848: 844: 835: 833: 825: 824: 820: 811: 809: 796: 795: 791: 782: 780: 767: 766: 762: 753: 751: 738: 737: 733: 723: 721: 716: 715: 711: 707: 685: 654: 648: 642: 636: 625: 619: 613: 607: 597: 594: 582:/ /offline.html 578: 567: 555: 547: 525: 520: 505: 490: 486: 479: 474: 473: 470: 467: 464: 461: 458: 455: 451: 448: 445: 442: 439: 436: 433: 430: 427: 424: 421: 418: 415: 412: 409: 406: 403: 400: 397: 394: 391: 388: 385: 382: 379: 376: 372: 369: 366: 363: 360: 357: 354: 351: 348: 345: 342: 339: 336: 333: 320: 319: 316: 313: 310: 307: 304: 301: 297: 294: 291: 288: 285: 282: 279: 276: 273: 270: 259: 253: 249: 227:. These can be 209: 189:service workers 177:web application 147: 131: 104: 92: 76: 71: 65: 59: 53:under the name 39: 28: 25: 12: 11: 5: 1072: 1070: 1062: 1061: 1056: 1046: 1045: 1042: 1041: 1036: 1031: 1026: 1012: 1011:External links 1009: 1007: 1006: 976: 948: 911: 864: 842: 818: 789: 760: 731: 708: 706: 703: 702: 701: 696: 694:Offline reader 691: 684: 681: 680: 679: 676: 673: 670: 667:HTTP error 404 659: 658: 652: 646: 640: 630: 629: 623: 617: 611: 593: 590: 576: 566: 563: 553: 546: 543: 539: 538: 535: 532: 524: 521: 518: 503: 487:CACHE MANIFEST 478: 475: 332: 327:cache.appcache 269: 258:The attribute 248: 245: 208: 205: 167: 166: 145: 141: 140: 137: 128: 127: 122: 116: 115: 110: 106: 105: 102: 100: 94: 93: 90: 88: 78: 77: 42: 40: 33: 26: 13: 10: 9: 6: 4: 3: 2: 1071: 1060: 1057: 1055: 1052: 1051: 1049: 1040: 1037: 1035: 1032: 1030: 1027: 1025: 1021: 1018: 1015: 1014: 1010: 994: 990: 986: 980: 977: 965: 961: 955: 953: 949: 936: 932: 928: 922: 920: 918: 916: 912: 901:on 2011-10-03 900: 896: 895: 887: 885: 883: 881: 879: 877: 875: 873: 871: 869: 865: 853: 846: 843: 832: 828: 822: 819: 808:on 2023-05-02 807: 803: 799: 793: 790: 778: 774: 770: 764: 761: 750:on 2019-02-15 749: 745: 741: 735: 732: 719: 713: 710: 704: 700: 697: 695: 692: 690: 687: 686: 682: 677: 674: 671: 668: 664: 663: 662: 653: 647: 641: 635: 634: 633: 624: 618: 612: 606: 605: 604: 601: 591: 589: 587: 583: 575: 574: 570: 564: 562: 559: 552: 551: 544: 542: 536: 533: 530: 529: 528: 522: 517: 516: 512: 509: 502: 501: 497: 494: 484: 476: 330: 328: 323: 267: 265: 256: 246: 244: 242: 241:manifest file 238: 234: 230: 226: 221: 219: 215: 206: 204: 202: 198: 194: 190: 184: 182: 178: 174: 164: 146: 142: 138: 134: 129: 126: 123: 121: 117: 114: 111: 107: 101: 99: 95: 89: 87: 83: 70: 63: 58: 56: 52: 48: 43:This article 41: 37: 32: 31: 23: 19: 1034:HTML5 Rocks 997:. Retrieved 993:the original 988: 979: 967:. Retrieved 963: 939:. Retrieved 935:the original 930: 903:. Retrieved 899:the original 893: 855:. Retrieved 845: 834:. Retrieved 830: 821: 810:. Retrieved 806:the original 802:MDN Web Docs 801: 792: 781:. Retrieved 772: 763: 752:. Retrieved 748:the original 743: 734: 722:. Retrieved 712: 660: 631: 602: 595: 585: 581: 579: 572: 571: 568: 560: 556: 549: 548: 540: 526: 523:File headers 514: 513: 510: 506: 499: 498: 495: 482: 480: 326: 324: 321: 263: 257: 250: 222: 210: 185: 172: 170: 72:}} 66:{{ 44: 960:"Dev.Opera" 655:Updateready 643:Downloading 614:Downloading 133:Open format 1048:Categories 905:2018-11-16 836:2023-04-09 831:www.w3.org 812:2020-12-29 783:2021-09-02 754:2021-04-11 705:References 592:Event flow 573:Example 4: 550:Example 3: 515:Example 2: 500:Example 1: 237:JavaScript 220:manifest. 207:Background 157:/multipage 699:Web cache 401:></ 159:/browsers 91:.appcache 69:wikibooks 62:rewritten 51:Wikibooks 45:has been 18:Web cache 1020:Archived 985:"WHATWG" 857:23 April 777:Archived 683:See also 649:Progress 637:Noupdate 620:Progress 608:Checking 483:manifest 346:manifest 280:manifest 163:#offline 120:Standard 47:imported 999:3 April 969:3 April 941:3 April 773:web.dev 153:.whatwg 144:Website 724:30 May 626:Cached 477:Syntax 404:script 389:script 247:Basics 1059:HTML5 989:HTML5 964:HTML5 931:HTML5 689:HTML5 465:</ 456:</ 437:</ 380:title 377:</ 370:title 311:</ 302:</ 218:cache 214:HTML5 161:.html 151:.spec 125:HTML5 1001:2011 971:2011 943:2011 859:2014 726:2016 481:The 471:> 468:html 462:> 459:body 452:> 449:body 446:< 443:> 440:head 434:> 425:href 413:link 410:< 407:> 386:< 383:> 375:Test 373:> 367:< 364:> 361:head 358:< 355:> 343:html 340:< 317:> 314:html 308:> 305:body 300:… 298:> 295:body 292:< 289:> 277:html 274:< 264:html 229:HTML 225:URLs 171:The 155:.org 149:html 416:rel 392:src 233:CSS 201:W3C 181:W3C 139:Yes 49:to 1050:: 987:. 962:. 951:^ 929:. 914:^ 867:^ 829:. 800:. 775:. 771:. 742:. 235:, 231:, 203:. 1003:. 973:. 945:. 908:. 861:. 839:. 815:. 786:. 757:. 728:. 586:/ 491:# 428:= 419:= 395:= 349:= 283:= 135:? 74:. 57:. 24:.

Index

Web cache
Progressive web application
Wikibooks logo
imported
Wikibooks
Cache manifest in HTML5
rewritten
wikibooks
Filename extension
Internet media type
World Wide Web Consortium
Standard
HTML5
Open format
html.spec.whatwg.org/multipage/browsers.html#offline
web application
W3C
service workers
web application manifests
progressive web app
W3C
HTML5
cache
URLs
HTML
CSS
JavaScript
manifest file
HTTP error 404
HTML5

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.