- 浏览: 793752 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (651)
- Java (39)
- Java 初学者小问题 (66)
- 设计模式 (7)
- 项目管理 (3)
- 数据库 (1)
- 算法 (2)
- Java practices (6)
- Effective Java2读书笔记 (78)
- Linux (2)
- programming ruby 读书笔记 (5)
- Core Java Ninth Edition Volume I 读书笔记 (15)
- Pro Git 读书笔记 (12)
- Git (3)
- Maven in Action 读书笔记 (20)
- Web (12)
- 非技术类书籍 (11)
- 电影 (40)
- Web Cache (1)
- jquery (0)
- 历史 (4)
- Dive Into HTML5 读书笔记 (13)
- 三国演义小学毕业考 (79)
- 高效能人士的7个习惯 读书笔记 (12)
- Java Performance 读书笔记 (3)
- Protocol Buffer 学习笔记 (6)
- Mongo DB 学习笔记 (7)
- Morphia 学习笔记 (7)
- Algorithms -- Princeton 学习笔记 (13)
- String研究 (10)
- Hadoop: The Definitive Guide 读书笔记 (3)
- Java与模式读书笔记 (5)
- Date研究 (3)
- The Roman Empire 听课笔记 (4)
- Algorithms -- Standford 学习笔记 (16)
- Core Java Ninth Edition Volume II 读书笔记 (9)
- Thinking in Java 4th Edition 读书笔记 (21)
- Node : Up and Running 学习笔记 (5)
- Eloquent Javascript (8)
- Smashing Node.js 读书笔记 (1)
- Algorithms II -- Standford 学习笔记 (19)
- Algorithm II -- Princeton 学习笔记 (14)
- 网络安全 (2)
- Javascript (4)
- 正则表达式 (1)
- JAVA 7/8 (15)
- JVM (10)
- NodeJS (1)
- 鸟哥的linux私房菜读书笔记 (14)
- Web Service (1)
- The art of programming (9)
- Introduction to Algorithm 读书笔记 (4)
- Java 源码阅读 (0)
- Spring in Action 读书笔记 (2)
- Java Network Programming 读书笔记 (2)
最新评论
-
心存高远:
谢谢作者分享,刚好看到这里不太明白,现在茅塞顿开。不过runt ...
关于 Maven的传递依赖的理解 -
sxlkk:
851228082 写道甚至在某次技术会议现场遇到《Maven ...
关于 Maven的传递依赖的理解 -
851228082:
851228082 写道a----compile----b-- ...
第五章 坐标和依赖 -
851228082:
a----compile----b-----provided- ...
第五章 坐标和依赖 -
851228082:
甚至在某次技术会议现场遇到《Maven in action》的 ...
关于 Maven的传递依赖的理解
1. An offline web application is a list of URLs — HTML, CSS, JavaScript, images, or any other kind of resource. The home page of the offline web application points to this list, called a manifest file, which is just a text file located elsewhere on the web server. A web browser that implements HTML5 offline applications will read the list of URLs from the manifest file, download the resources, cache them locally, and automatically keep the local copies up to date as they change. When the time comes that you try to access the web application without a network connection, your web browser will automatically switch over to the local copies instead.
2. There’s a flag in the DOM that will tell you whether you’re online or offline. There are events that fire when your offline status changes (one minute you’re offline and the next minute you’re online, or vice-versa).
3. A cache manifest file is a list of all of the resources that your web application might need to access while it’s disconnected from the network. In order to bootstrap the process of downloading and caching these resources, you need to point to the manifest file, using a manifest attribute on your <html> element:
<!DOCTYPE HTML> <html manifest="/cache.manifest"> <body> ... </body> </html>
Your cache manifest file must be served with the content type text/cache-manifest .
4. Every page of your web application needs a manifest attribute that points to the cache manifest for the entire application.
5. The first line of every cache manifest file is:
CACHE MANIFEST
After that, all manifest files are divided into three parts: the “explicit” section, the “fallback” section, and the “online whitelist” section. Each section has a header, on its own line. If the manifest file doesn’t have any section headers, all the listed resources are implicitly in the “explicit” section.
6. The line marked CACHE: is the beginning of the “explicit” section. Resources in the “explicit” section will get downloaded and cached locally, and will be used in place of their online counterparts whenever you are disconnected from the network.
7.
When you navigate to an HTML
page with a
manifest
attribute, the page itself is assumed to be part of the web
application, so you don’t need to list it in the manifest file itself. However,
if your web application spans multiple pages, you should list all of the HTML
pages in the manifest file, otherwise the browser would not know that there are
other HTML pages that need to be downloaded and cached.
8. The line marked NETWORK: is the beginning of the “online whitelist” section. Resources in this section are never cached and are not available offline. (Attempting to load them while offline will result in an error.)
9. The line marked FALLBACK: is the beginning of the “fallback” section. In a fallback section, you can define substitutions for online resources that, for whatever reason, can’t be cached or weren’t cached successfully:
CACHE MANIFEST FALLBACK: / /offline.html NETWORK: *
The first part of the line (before the space) is URL pattern. The single character (/) will match any page on your site. When you try to visit a page while you’re offline, if your browser doesn’t find the page in the appcache, instead of displaying an error message, it will display the page /offline.html , as specified in the second half of that line in the fallback section.
10. When you visit any page that points to a cache manifest, your browser says “hey, this page is part of an offline web application, is it one I know about?” If your browser hasn’t ever downloaded this particular cache manifest file, it will set up a new offline “appcache” (short for “application cache”), download all the resources listed in the cache manifest, and then add the current page to the appcache. If your browser does know about this cache manifest, it will simply add the current page to the existing appcache. It means that you can have an offline web application that “lazily” adds pages as you visit them. You don’t need to list every single one of your HTML pages in your cache manifest.
11.
A single start character (
*
) has
special meaning in a network
section. It’s called the “online whitelist
wildcard flag.” That’s a fancy way of saying that anything that isn’t in the
appcache can still be downloaded from the original web address, as long as you
have an internet connection. This is important for an “open-ended” offline web
application. Without this wildcard flag, the browser wouldn’t load any
externally-hosted images or videos.
12. When your browser visits a page that points to a cache manifest, it fires off a series of events on the window.applicationCache object:
a) As soon as it notices a manifest attribute on the <html> element, your browser fires a checking event. The checking event is always fired, regardless of whether you have previously visited this page or any other page that points to the same cache manifest.
b) If your browser has never seen this cache manifest before:
§ It will fire a downloading event, then start to download the resources listed in the cache manifest.
§ While it’s downloading, your browser will periodically fire progress events, which contain information on how many files have been downloaded already and how many files are still queued to be downloaded.
§ After all resources listed in the cache manifest have been downloaded successfully, the browser fires one final event, cached .
c) On the other hand, if you have previously visited this page or any other page that points to the same cache manifest, your browser will check whether the cache manifest changed since the last time your browser checked it:
§ If the answer is no, your browser will immediately fire a noupdate event.
§ If the answer is yes, your browser will fire a downloading event and start re-downloading every single resource listed in the cache manifest. While it’s downloading, your browser will periodically fire progress events, which contain information on how many files have been downloaded already and how many files are still queued to be downloaded. After all resources listed in the cache manifest have been re-downloaded successfully, the browser fires one final event, updateready .
§ The new version is not yet in use. To “hot-swap” to the new version without forcing the user to reload the page, you can manually call the window.applicationCache.swapCache() function.
13. If, at any point in the above process, something goes horribly wrong, your browser will fire an error event and stop. Here is a hopelessly abbreviated list of things that could go wrong:
a) The cache manifest returned an HTTP error 404 (Page Not Found) or 410 (Permanently Gone).
b) The cache manifest was found and hadn’t changed, but the HTML page that pointed to the manifest failed to download properly.
c) The cache manifest changed while the update was being run.
d) The cache manifest was found and had changed, but the browser failed to download one of the resources listed in the cache manifest.
14. Your browser checks whether a cache manifest file has change as below:
a) Via normal HTTP semantics, Some of these HTTP headers (Expires and Cache-Control) tell your browser how it is allowed to cache the file without ever asking the server whether it has changed.
b) If the cache manifest has expired (according to its HTTP headers), then your browser will ask the server whether there is a new version, and if so, the browser will download it.
c) Once it’s downloaded the new cache manifest file, your browser will check the contents against the copy it downloaded last time. If the contents of the cache manifest file are the same as they were last time, your browser won’t re-download any of the resources listed in the manifest.
15. If your cache manifest file hasn’t changed, the browser will never notice that one of the previously cached resources has changed. The easiest way is to include a comment line with a revision number in cache manifest. Change the revision number in the comment when some of the resources listed in cache manifest has been changed. Then the web server will return the newly changed cache manifest file, your browser will notice that the contents of the file have changed, and it will kick off the process to re-download all the resources listed in the manifest.
发表评论
-
《Dive into HTML5》 读后感
2012-06-20 07:57 1509读这本书的起因是参加了2012年的Qcon,对其中某个 ... -
Manipulating History for Fun & Profit
2012-06-20 07:29 10481. The HTML5 history AP ... -
“Distributed,”“Extensibility,”& Other Fancy Words
2012-06-15 15:54 8901. Microdata annotates t ... -
A Form of Madness
2012-06-11 10:41 9701. Placeholder text is d ... -
A Place To Put Your Stuff
2012-06-09 17:55 9341. Cookies have three po ... -
You Are Here (And So Is Everybody Else)
2012-06-09 16:06 11131. Geolocation is the ar ... -
Video in a Flash (Without That Other Thing)
2012-06-08 15:46 11151. HTML5 defines a standard wa ... -
Let’s Call It A Draw(ing Surface)
2012-06-06 17:19 11881. HTML 5 defines the &l ... -
What Does It All Mean?
2012-06-03 19:23 10781. In Activating Browse ... -
Detecting HTML5 Features
2012-05-24 19:05 10731. There are four basic ... -
A Quite Biased History of HTML5
2012-05-23 20:02 10841. “content type” or “MIM ... -
Introduction: Five Things You Should Know About HTML5
2012-05-22 15:23 10071. HTML5 is a collectio ...
相关推荐
调研_k8s_集群离线安装方式_k8s-offline-install.zip调研_k8s_集群离线安装方式_k8s-offline-install.zip 调研_k8s_集群离线安装方式_k8s-offline-install.zip 调研_k8s_集群离线安装方式_k8s-offline-install.zip ...
其中一个常见的问题是,在测试或部署阶段,无论何时尝试访问网站的任何页面,都只会看到一个提示页面:“This application is currently offline. To enable the application, remove the app_offline....
AI2 Offline Companion.apk
Offline Render is an easy to use, realtime capture...Offline Render allows you to render your Unity scenes and take them into a standard post-production pipeline using your favorite compositing software.
【标题】"DriverPack Offline 数据包" 【描述】"fhbngbejdkgjnfndbgnghn" 这段描述看似随机的字符组合,无法直接解析出具体的信息,但我们可以推测它可能是某种加密或者混淆后的信息,通常在安全传输或隐藏数据时会...
offline explore enterprise·7.5 解压后直接双击根目录下的exe即可
离线浏览器Portable Offline Browser是一款专为用户在无网络环境下访问网站设计的软件工具。它允许用户将整个网站或其中特定部分下载到本地计算机上,以便在没有互联网连接时也能浏览内容。这款国外开发的优秀离线...
Android studio离线组件最新版本的 Google Maven 依赖项offline-gmaven-stable,文件分割成 三个 压缩包,必须集齐 三个 文件后才能一起解压一起使用: Android studio离线组件offline-gmaven-stable.part1.rar ...
标题中的"CapsWriter-Offline.zip"表明这可能是一个离线版本的软件或工具包,用于创建或处理大写字母为主的文本。"CapsWriter"可能是这个工具的名称,而"Offline"提示它不需要互联网连接即可使用。这个压缩包可能...
Android studio离线组件最新版本的 Google Maven 依赖项offline-gmaven-stable,文件分割成 三个 压缩包,必须集齐 三个 文件后才能一起解压一起使用: Android studio离线组件offline-gmaven-stable.part1.rar ...
然而,有时我们可能会遇到“device offline”的错误提示,这通常意味着ADB无法识别或连接到设备。本篇将详细介绍如何解决“adb error: device offline”问题,并重点讨论在Android 4.2.2版本下使用ADB及Fastboot工具...
Offline Explorer Enterprise 注册机 内含 MetaProducts.Offline.Explorer.Enterprise.6.6.3970 对于以后的版本,注册机可用的概率非常大。 Offline Explorer 是非常好用的离线浏览工具,推荐使用!
IAR Offline License Generator v1.4 by unis用于IAR注册
harbor-offline-installer-v2.8.3安装包
harbor-offline-installer-v2.2.1
官方地址 https://github.com/vmware/harbor/releases/download/v1.2.0/harbor-offline-installer-v1.2.0.tgz,可以先尝试从官方下载,如果中断或者下载失败,可以下载此版本...harbor-offline v1.2.0 避免龟速下载安装
1. `install.bat`:这是一个批处理文件,通常用于自动化执行一系列命令,可能是用来运行“Offline NT Password and Registry Editor”的安装或启动过程。 2. `bd050303.bin`:这可能是一个二进制文件,可能是程序的...
Android studio离线组件最新版本的 Google Maven 依赖项offline-gmaven-stable,文件分割成 三个 压缩包,必须集齐 三个 文件后才能一起解压一起使用: Android studio离线组件offline-gmaven-stable.part1.rar ...
Offline Explorer 8.4