离线缓存(HTML5)(Offline Caching(HTML5))
我使用HTML 5离线缓存方法从服务器更新缓存信息面临一些困难。
这是步骤列表,
1-创建一个cache.manifest文件,其中包含以下条目
CACHE MANIFEST # Version 1.0 CACHE: /loading.js /images/pan-icon.png NETWORK: *
然后我开始添加以下事件绑定器以从服务器加载更新的信息
window.addEventListener('load', function (e) { window.applicationCache.update(); window.applicationCache.addEventListener('updateready', function (e) { if (window.applicationCache.status == window.applicationCache.UPDATEREADY) { // Browser downloaded a new app cache. window.applicationCache.swapCache(); console.log('Updated'); } else { console.log('No Update'); } }, false); }, false);
但它总是无法从服务器获得最新的'loading.js'。 我需要清除缓存以从服务器获取更新。
有没有办法更新这个。
请帮帮我
我正在使用ASP .NET MVC框架来构建我的Web应用程序
I am facing some difficulty to update cache information from the server by using HTML 5 offline caching method.
Here is the list of steps,
1- Created one cache.manifest file with following entries
CACHE MANIFEST # Version 1.0 CACHE: /loading.js /images/pan-icon.png NETWORK: *
Then i jest add following event binder to load updated information from the server
window.addEventListener('load', function (e) { window.applicationCache.update(); window.applicationCache.addEventListener('updateready', function (e) { if (window.applicationCache.status == window.applicationCache.UPDATEREADY) { // Browser downloaded a new app cache. window.applicationCache.swapCache(); console.log('Updated'); } else { console.log('No Update'); } }, false); }, false);
But it alwayes failed to get latest 'loading.js' from the server. I need to clear the cache to get update from the server.
Is there any way to update this forefully.
Please help me
I am using ASP .NET MVC framework to build my web application
原文:https://stackoverflow.com/questions/28856327
最满意答案
memcpy
的第三个参数是要复制的字节数。 你提供了int
的数量。 改为:memcpy ( k_src, &handle->_context._buf[0], handle->_context._bufLen * sizeof(int) );
The third argument to
memcpy
is the number of bytes to copy. You provided the number ofint
s. Do this instead:memcpy ( k_src, &handle->_context._buf[0], handle->_context._bufLen * sizeof(int) );
相关问答
更多-
memcpy的第三个参数是要复制的字节数。 你提供了int的数量。 改为: memcpy ( k_src, &handle->_context._buf[0], handle->_context._bufLen * sizeof(int) ); The third argument to memcpy is the number of bytes to copy. You provided the number of ints. Do this instead: memcpy ( k_src, &han ...
-
对我来说,看起来你只是有一个错字。 这个: thrust::copy_if(t_inputArray, t_inputArray + size, d_outputArray, is_positive()); ^ 应该是这样的: thrust::copy_if(t_inputArray, t_inputArray + size, t_outputArray, is_positive()); 你已经将原始指 ...
-
extern结构数组错误:数组类型具有不完整的元素类型(extern struct array error: array type has incomplete element type)[2022-07-16]
感谢大家的帮助。 这个问题最终在main.c出现拼写错误。 就像是: extern struct _infoo info[]; 当typedef替换它们时,一切工作都很好。 Thanks for everybody's help. This question end up with a misspelling in main.c. Something like: extern struct _infoo info[]; When typedef replace them, all work fine def ... -
'sizeof'应用于不完整类型'struct array []'(invalid application of 'sizeof' to incomplete type 'struct array[]')[2023-08-25]
对于你的sizeof(command_table)的工作,它需要看到这个: static struct command command_table[] = { {"help", help_init, help_exec}, }; 但它只看到这一点: extern struct command command_table[]; 看到sizeof()永远不会知道有多少元素实际在那里。 顺便说一句,还有另一个问题。 static使数组在所有其他模块中不可见。 你必须删除它或解决它。 您的选项(删除st ... -
C ++ struct array copy(C++ struct array copy)[2023-05-24]
只有在您复制的对象是所谓的POD(普通旧数据结构)时, 才允许使用memcpy。 但是你的struct包含不是POD的std :: string对象。 因此,您的整个结构不是POD。 请改用算法标头中的std :: copy。 You are only allowed to use memcpy in case the objects you're copying are so-called PODs (plain old data structures). But your struct contains ... -
memcpy(inodetable.inodes[0], &rootinode, sizeof rootinode)将起作用。 inodetable是一种struct类型,您无法将其编入索引。 另一个选项是memcpy(&inodetable, &rootinode, sizeof rootinode) ,尽管明确命名成员不那么容易混淆。 但是,您不需要使用memcpy()来复制struct 。 简单的任务将起作用: inodetable.inodes[0] = rootinode; 请注意,这仅适用于s ...
-
无论struct my_error_mgr是什么,编译器都无法将其声明作为类型找到。 您需要包含具有该声明的标头。 Whatever struct my_error_mgr is, the compiler can't find its declaration as a type. You need to include the header that has that declaration.
-
您将匿名结构定义为myTasks 。 要声明您的数组,请使用myTasks taskInfo[2500] 。 C认为你正在声明一个新命名的 struct struct myTasks ,并且它不完整,因为你没有定义结构。 但是, myTasks是您已定义的结构的别名。 You typedefed the anonymous struct to myTasks. To declare your array, use myTasks taskInfo[2500]. C thinks you are declar ...
-
在本地范围内声明变量时(例如在函数体中),您可以执行此操作并且编译器不会抱怨,它将推断出您指的是3个元素的int数组。 void someFunc() { int idk[] = { 1,2,3 }; // Ok, so idk is in fact a int[3]; // Do whatever work... } 当在类或结构声明中执行相同的操作时,编译器不希望为您推导出相同的内容,因此基本上,您需要更严格。 完整的原因,您可以在这里看到( 不能从成员变量中的初始化器字符串中推断出数 ...
-
使用另一个_buffwrt.flush(); 在循环之外冲洗剩余的东西,不要忘记_buffwrt.close(); 最后 更新 @Svetlin Zarev提到一个好点,只有_buffwrt.close(); 最后将足以清除剩余的任何内容http://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html#close%28%29 use another _buffwrt.flush(); outside the loop to flush ...