Comments (9)
在一般的浏览器运行该逻辑有没效果呢?
from jquery-ajax-cache.
看起来也没有作用;
我尝试定位了下,下面这个接口看起来没有调用
cacheValidate: function (res, options) {
return true;
},
from jquery-ajax-cache.
1、你用的什么版本的jquery?
2、是不是按照这个顺序引入的?
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src='../dist/jquery-ajax-cache.min.js'></script>
from jquery-ajax-cache.
<script language="JavaScript" src="js/jquery-1.9.1.min.js"> </script>
<script language="JavaScript" src="js/jquery-ajax-cache.js"></script>
from jquery-ajax-cache.
全局需要先调用下 $ajaxCache.config();
参考下面代码:
<!DOCTYPE html>
<html>
<head>
<title>test jquery-ajax-cache</title>
<head>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery-ajax-cache.js"></script>
<script>
$ajaxCache.config();
$.ajax({
ajaxCache: {
cacheValidate: function(res, options) {
return true;
},
storageType: 'localStorage',
timeout: 30,
forceRefresh: false
},
type: "GET",
url: "https://api.github.com/repos/WQTeam/jquery-ajax-cache",
dataType: "json",
success: function(data) {
console.log(data);
}
})
</script>
</html>
from jquery-ajax-cache.
增加了$ajaxCache.config();之后,在PC上是可以了。
但是在APP里还是不行。
PS:我在设置webview参数的时候,并没有打开cache,因为网页本身我不希望受到缓存的影响,这个有关系吗?
from jquery-ajax-cache.
@wangxiaote ,应该有关系的。你打开cache试试。
from jquery-ajax-cache.
var cacheProxy = $ajaxCache.getCacheProxy();
var ajaxCacheOptions = options.ajaxCache;
if (ajaxCacheOptions) {
var storage = cacheProxy.getStorage(ajaxCacheOptions.storageType);
if (!storage.isSupported()) {
return;
}
调试的结果,storage.isSupported()是false;
现在APP中的webview设置如下:
webSettings.setAppCacheEnabled(true);
webSettings.setAppCachePath(this.getContext().getCacheDir().getAbsolutePath());
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
from jquery-ajax-cache.
storageType: 'sessionStorage' 这样就可以了。
from jquery-ajax-cache.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-ajax-cache.