Javascript 应用程序缓存清单-在服务器上更新内容,但客户端不显示更新的内容
首先,我对我的英语感到抱歉,我的英语不好Javascript 应用程序缓存清单-在服务器上更新内容,但客户端不显示更新的内容,javascript,jquery,html,json,Javascript,Jquery,Html,Json,首先,我对我的英语感到抱歉,我的英语不好 若服务器更新了页面内容(html),那个么我就点击按钮f5来更新页面内容 在客户端重新加载此页面,此页面将显示更新的内容。 怎么做 我有一个json文件,这个页面有一个按钮。当我点击按钮时, 将显示json文件的内容。如果我编辑了这个json文件,那么 重新加载页面并单击此按钮,它将显示已编辑的json文件。怎么做 我在服务器上更改页面内容时使用了缓存清单,然后 在客户端重新加载页面,客户端的内容未更改 我在Firefox30上执行了它,失败了。但它
- 若服务器更新了页面内容(html),那个么我就点击按钮f5来更新页面内容 在客户端重新加载此页面,此页面将显示更新的内容。 怎么做
- 我有一个json文件,这个页面有一个按钮。当我点击按钮时, 将显示json文件的内容。如果我编辑了这个json文件,那么 重新加载页面并单击此按钮,它将显示已编辑的json文件。怎么做
- 我在服务器上更改页面内容时使用了缓存清单,然后 在客户端重新加载页面,客户端的内容未更改
<!DOCTYPE html>
<html lang="ja" manifest="test.appache">
<!--<html lang="ja" manifest="test.manifest">-->
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<script src="jquery-2.1.1.min.js"></script>
<script src="test.js"></script>
<script>
$(function() {
updateAppCache();
});
</script>
<title>cache test</title>
</head>
<body>
Cache Test v15<br>
<button onClick="loadJSON('msg')">Load Json</button>
<div id="msg"></div>
<br>
<a href="test.html">test.html</a>
<!--<img src="1.jpg" >--> //content I want to edit, it will show at client
<!--<img src="2.jpg" >--> //content I want to edit, it will show at client
<img src="3.jpg" >
<img src="4.jpg" >
</body>
</html>
test.appcache:
CACHE MANIFEST
# 2014-07-13:v15
# AddType text/cache-manifest .appcache
# Explicitly cached 'master entries'.
CACHE:
cache_test.html
jquery-2.1.1.min.js
test.json
test.js
test.html
#1.jpg //content i want to save at the application cache at client.
#2.jpg //content i want to save at the application cache at client.
3.jpg
4.jpg
# Resources that require the user to be online.
NETWORK:
FALLBACK:
test.json:
{ "test":"What's up man!?", "foo":"---------" }
我要编辑的json文件的内容:
{ "test":"What's up man!?", "foo":"I will always love you" }
当服务器上使用缓存的内容(html、图像、css、javascript)发生更改时,您只需修改请求url即可强制重新加载。例如:
源url为:修改test.html内容后,
客户端浏览器中的html肯定会完全重新加载。你可以观察firebug的变化
{ "test":"What's up man!?", "foo":"I will always love you" }